public static bool Decode(byte[] packetData, ref PKTArrayTest2 packet)
        {
            int readPos = 0;

            packet.Count = BitConverter.ToInt16(packetData, readPos);
            readPos     += 2;

            for (short i = 0; i < packet.Count; ++i)
            {
                var charItem = new CharItem();
                charItem.ItemCode = BitConverter.ToInt32(packetData, readPos);
                readPos          += 4;
                charItem.Level    = BitConverter.ToInt32(packetData, readPos);
                readPos          += 4;
                charItem.Exp      = BitConverter.ToSingle(packetData, readPos);
                readPos          += 4;

                packet.ItemList.Add(charItem);
            }

            return(true);
        }
Exemple #2
0
        public static bool Decode(byte[] packetData, ref PKTArrayTest2 packet)
        {
            int readPos = 0;

            packet.Count = BitConverter.ToInt16(packetData, readPos);
            readPos += 2;

            for (short i = 0; i < packet.Count; ++i)
            {
                var charItem = new CharItem();
                charItem.ItemCode = BitConverter.ToInt32(packetData, readPos);
                readPos += 4;
                charItem.Level = BitConverter.ToInt32(packetData, readPos);
                readPos += 4;
                charItem.Exp = BitConverter.ToSingle(packetData, readPos);
                readPos += 4;

                packet.ItemList.Add(charItem);
            }

            return true;
        }