public override void Deserialize(ref PacketInStream Data) { if (PacketType == EPacketFieldType.True) val = (bool)true; else val = (bool)false; }
public override void Deserialize(ref PacketInStream Data) { val = Data.ReadEncoded7Bit(); }
public bool ReadPacket() { if (Received.Count <= 0) { return(false); } if (!ReceiveCompress && !Crypted) { PacketInStream Packet = new PacketInStream(Received.ToArray(), Received.Count); long Size = Packet.ReadEncoded7Bit(); if (Size > Packet.Length) { return(false); } Received.RemoveRange(0, (int)(Packet.Position + Size)); ISerializablePacket Pack = PacketProcessor.ReadPacket(ref Packet); if (Pack != null) { Pack.OnRead(this); } return(true); } if (Crypted) { byte[] Packet = Received.ToArray(); Received.Clear(); Decrypt(Packet); } if (ReceiveCompress) { int End = -1; while ((End = GetEndCompression(ref Decrypted)) >= 0) { byte[] ToUnCompress = new byte[End]; Buffer.BlockCopy(Decrypted.ToArray(), 0, ToUnCompress, 0, End); Decrypted.RemoveRange(0, End); byte[] Result = UnCompress(ToUnCompress); Log.Dump("Decrypted", Result, 0, Result.Length); PacketInStream Packet = new PacketInStream(Result, Result.Length); long Size = Packet.ReadEncoded7Bit(); if (Size > Packet.Length) { Log.Error("ReadPacket", "Size > Packet.Lenght,Size=" + Size + ",Lenght=" + Packet.Length); Packet.Dispose(); continue; } ISerializablePacket Pack = PacketProcessor.ReadPacket(ref Packet); if (Pack != null) { Pack.OnRead(this); } Packet.Dispose(); } } return(false); }
public override void Deserialize(ref PacketInStream Data) { val = Data.Read(4); }
public override void Deserialize(ref PacketInStream Data) { long Size = Data.ReadEncoded7Bit(); val = Data.Read((int)Size); }
public static ISerializablePacket ReadPacket(ref PacketInStream Stream) { return((ISerializablePacket)ReadField(ref Stream, 0, (int)EPacketFieldType.Packet).val); }
public abstract void Deserialize(ref PacketInStream Data);