Ejemplo n.º 1
0
        public ConanPacket(ConanStream stream)
            : base(stream)
        {
            Length = stream.ReadUInt32();

            Crc32      = stream.ReadUInt32();
            Headersize = stream.ReadUInt32();

            Sender    = stream.ReadByte();
            SenderInt = stream.ReadArrayPrependLengthByte();

            Receiver    = stream.ReadByte();
            ReceiverInt = stream.ReadArrayPrependLengthByte();

            Opcode = stream.ReadUInt16();

            if (!Valid)
            {
                Console.WriteLine("Invalid Packet");
                return;
            }

            var checkHeaderLength = Headersize - (uint)(sizeof(uint) + SenderInt.Length + ReceiverInt.Length);

            if (checkHeaderLength > 0)
            {
                HeaderData = new ConanStream(stream.ReadArray(checkHeaderLength - sizeof(byte) * 2));
            }

            var dataLength = Length - (Headersize + sizeof(uint) * 2);

            if (dataLength > 0)
            {
                Data = new ConanStream(stream.ReadArray(dataLength));
            }
        }
Ejemplo n.º 2
0
 public Packet(ConanStream stream)
 {
     OriginalStream  = stream;
     stream.Position = 0;
 }
Ejemplo n.º 3
0
 protected Packet(ConanStream stream)
 {
     Stream          = stream;
     stream.Position = 0;
 }