Пример #1
0
        public override void Deserialize(ref PacketInStream Data)
        {
            long DicData = Data.ReadEncoded7Bit();

            int KeyType;
            int ValueType;
            int Count;

            PacketInStream.Decode3Parameters(DicData, out KeyType, out ValueType, out Count);
            Dictionary <ISerializableField, ISerializableField> Dic = new Dictionary <ISerializableField, ISerializableField>();


            Log.Debug("DicBitField", "KeyType = " + KeyType + ",ValueType=" + ValueType + ",Count=" + Count);

            for (int i = 0; i < Count; ++i)
            {
                ISerializableField Key   = PacketProcessor.ReadField(ref Data, i, KeyType);
                ISerializableField Value = PacketProcessor.ReadField(ref Data, i, ValueType);

                if (Key != null && Value != null)
                {
                    Dic.Add(Key, Value);
                }
            }

            val = Dic;
        }
Пример #2
0
        public override void Deserialize(ref PacketInStream Data)
        {
            long Opcode = Data.ReadEncoded7Bit();
            PacketHandlerDefinition Handler = PacketProcessor.GetPacketHandler(Opcode);
            ISerializablePacket     Packet  = Activator.CreateInstance(Handler.GetClass()) as ISerializablePacket;

            ISerializableField Field = null;

            Log.Debug("Packet", "----------------------> New " + Opcode.ToString("X8"));
            Packet.Opcode = Opcode;

            while ((Field = PacketProcessor.ReadField(ref Data)) != null)
            {
                Log.Debug("Packet", "------> ++T : " + Field.PacketType);
                Packet.AddField(Field.Index, Field);
            }

            Log.Debug("Packet", "----------------------> End ");

            Packet.ApplyToFieldInfo();
            val = Packet;
        }