コード例 #1
0
        public void Unpack(byte[] bytes)
        {
            Id       = bytes[0];
            Accepted = bytes[1];

            ReasonForDecline = StringPacker.UnpackString(bytes.Skip(2).ToArray(), out bytes);
            MotD             = StringPacker.UnpackString(bytes, out bytes);
            WelcomeMessage   = StringPacker.UnpackString(bytes, out bytes);
            ActiveUsers      = StringPacker.UnpackList(bytes, out bytes);
        }
コード例 #2
0
        public void Unpack(byte[] bytes)
        {
            Id = bytes[0];

            ActiveUsers = StringPacker.UnpackList(bytes.Skip(1).ToArray(), out bytes);

            var unparsedList = StringPacker.UnpackList(bytes, out bytes);

            NewChats = new List <Chat>();

            for (int i = 0; i < unparsedList.Count; i += 2)
            {
                var newChat = new Chat()
                {
                    Username = unparsedList[i],
                    Message  = unparsedList[i + 1]
                };

                NewChats.Add(newChat);
            }
        }