Exemplo n.º 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("DicBit", "KeyType=" + KeyType + ",ValueType=" + ValueType + ",Count=" + Count);
            for (int i = 0; i < Count; ++i)
            {
                Log.Debug("DicBit", "Deserialise : Index=" + i + ",Type=" + KeyType);

                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;
        }
Exemplo n.º 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;

            Packet.Opcode = Opcode;

            ISerializableField Field = null;

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

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

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

            Packet.ApplyToFieldInfo();
            val = Packet;
        }