{"action":"created","issue":{"url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/69","repository_url":"https://api.github.com/repos/jefffhaynes/BinarySerializer","labels_url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/69/comments","events_url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/69/events","html_url":"https://github.com/jefffhaynes/BinarySerializer/issues/69","id":234894047,"number":69,"title":"Setting byte length to lists","user":{"login":"ricebus","id":12892036,"avatar_url":"https://avatars1.githubusercontent.com/u/12892036?v=3","gravatar_id":"","url":"https://api.github.com/users/ricebus","html_url":"https://github.com/ricebus","followers_url":"https://api.github.com/users/ricebus/followers","following_url":"https://api.github.com/users/ricebus/following{/other_user}","gists_url":"https://api.github.com/users/ricebus/gists{/gist_id}","starred_url":"https://api.github.com/users/ricebus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricebus/subscriptions","organizations_url":"https://api.github.com/users/ricebus/orgs","repos_url":"https://api.github.com/users/ricebus/repos","events_url":"https://api.github.com/users/ricebus/events{/privacy}","received_events_url":"https://api.github.com/users/ricebus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-06-09T17:40:45Z","updated_at":"2017-06-09T20:48:17Z","closed_at":null,"body":"Hey,\r\n\r\nI have a protocol where each packet has several fields (hence the list)\r\nand inside each field it specifies the size of the field itself.\r\n\r\nproblem occurs when I want to deserialize.. I can't provide ItemCount.\r\nIs there any way to overcome this? Maybe someway to specify a byte counter attribute\r\nof some sort?\r\n\r\n```\r\n    class Packet\r\n    {\r\n        [FieldOrder(0)]\r\n        public uint Header { get; set }\r\n      \r\n        [FieldOrder(1)]\r\n        public uint ID { get; set; }\r\n\r\n        [FieldOrder(2)]\r\n        public ObservableCollection<Field> Fields { get; set; }\r\n\r\n        [FieldOrder(3)]\r\n        public uint Footer { get; set }\r\n    }\r\n\r\n    class Field\r\n    {\r\n        [FieldOrder(0)]\r\n        public uint Size { get; set; }\r\n\r\n        [FieldOrder(2)]\r\n        public byte[] Data { get; set; }\r\n    }\r\n\r\n```\r\n\r\nThanks in advance,\r\nGeorge"},"comment":{"url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/comments/307495937","html_url":"https://github.com/jefffhaynes/BinarySerializer/issues/69#issuecomment-307495937","issue_url":"https://api.github.com/repos/jefffhaynes/BinarySerializer/issues/69","id":307495937,"user":{"login":"jefffhaynes","id":9734727,"avatar_url":"https://avatars2.githubusercontent.com/u/9734727?v=3","gravatar_id":"","url":"https://api.github.com/users/jefffhaynes","html_url":"https://github.com/jefffhaynes","followers_url":"https://api.github.com/users/jefffhaynes/followers","following_url":"https://api.github.com/users/jefffhaynes/following{/other_user}","gists_url":"https://api.github.com/users/jefffhaynes/gists{/gist_id}","starred_url":"https://api.github.com/users/jefffhaynes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jefffhaynes/subscriptions","organizations_url":"https://api.github.com/users/jefffhaynes/orgs","repos_url":"https://api.github.com/users/jefffhaynes/repos","events_url":"https://api.github.com/users/jefffhaynes/events{/privacy}","received_events_url":"https://api.github.com/users/jefffhaynes/received_events","type":"User","site_admin":false},"created_at":"2017-06-09T20:48:17Z","updated_at":"2017-06-09T20:48:17Z","body":"Ah, good point. I'll add that. In general you should not need seekable streams.  Only in certain cases like explicitly terminated lists would the framework throw an exception if the stream is not seekable. So I would try serializing and deserializing directly to and from the TcpClient stream and see what happens.\r\n\r\n________________________________\r\nFrom: ricebus <notifications@github.com>\r\nSent: Friday, June 9, 2017 3:48:55 PM\r\nTo: jefffhaynes/BinarySerializer\r\nCc: Jeff Haynes; Comment\r\nSubject: Re: [jefffhaynes/BinarySerializer] Setting byte length to lists (#69)\r\n\r\n\r\nYour trick with the FieldLength worked, maybe worth mentioning in the docs that the units are bytes. Thanks for the quick response! 👍\r\n\r\nBTW, any recommendation on how to work with this and TcpClient? cause at the moment what I do is copy from the TcpClient's stream to a MemoryStream and then pass it to the deserializer. Kinda wrong, I know, but it asks for a seekable stream..\r\n\r\n—\r\nYou are receiving this because you commented.\r\nReply to this email directly, view it on GitHub<https://github.com/jefffhaynes/BinarySerializer/issues/69#issuecomment-307483373>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJSKR6kDWbodTv3OKLOeL-oVcz46Dp-sks5sCaGngaJpZM4N1pBY>.\r\n"}}
{"actor":{"display_login":"jefffhaynes"}}