Created
April 27, 2020 12:33
-
-
Save scottstamp/214ee15275561ced0c32af16c2d517f0 to your computer and use it in GitHub Desktop.
Parse incoming CatalogPagesList packet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sulakore.Protocol; | |
using System.Collections.Generic; | |
namespace WiredIdent | |
{ | |
public class HCatalogPage | |
{ | |
public bool Visible { get; set; } | |
public int Icon { get; set; } | |
public int Id { get; set; } | |
public string Link { get; set; } | |
public string Caption { get; set; } | |
public List<int> Offers { get; set; } | |
public List<HCatalogPage> Children { get; set; } | |
public static HCatalogPage Parse(HMessage p) | |
{ | |
var page = new HCatalogPage(); | |
page.Visible = p.ReadBoolean(); | |
page.Icon = p.ReadInteger(); | |
page.Id = p.ReadInteger(); | |
page.Link = p.ReadString(); | |
page.Caption = p.ReadString(); | |
page.Offers = new List<int>(p.ReadInteger()); | |
for (var i = 0; i < page.Offers.Capacity; i++) | |
page.Offers.Add(p.ReadInteger()); | |
page.Children = new List<HCatalogPage>(p.ReadInteger()); | |
for (var i = 0; i < page.Children.Capacity; i++) | |
page.Children.Add(Parse(p)); | |
return page; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment