Ejemplo n.º 1
0
        public void Decode(ref IncomingMessageBuffer buffer)
        {
            MessageIndex = -1;

            byte flags = buffer.NextByte;

            Reliability = (ReliabilityStatus)((flags & 0xE0) >> 5);
            IsSplit     = (flags & 0x10) > 0;

            int length = (int)Math.Ceiling((double)buffer.NextUShort / 8.0);

            if (Reliability == ReliabilityStatus.RELIABLE ||
                Reliability == ReliabilityStatus.RELIABLE_SEQUENCED ||
                Reliability == ReliabilityStatus.RELIABLE_ORDERED)
            {
                MessageIndex = buffer.NextIntTriad;
            }

            if (Reliability == ReliabilityStatus.UNRELIABLE_SEQUENCED ||
                Reliability == ReliabilityStatus.RELIABLE_SEQUENCED ||
                Reliability == ReliabilityStatus.RELIABLE_ORDERED)
            {
                OrderIndex   = buffer.NextIntTriad;
                OrderChannel = buffer.NextByte;
            }

            if (IsSplit)
            {
                SplitCount = buffer.NextInt;
                SplitID    = buffer.NextUShort;
                SplitIndex = buffer.NextInt;
            }

            Payload = buffer.NextBytes(length);
        }
        public override bool Parse(IncomingMessageBuffer buffer)
        {
            ClientID    = buffer.NextULong;
            SendPing    = buffer.NextULong;
            UseSecurity = buffer.NextBool;

            return(true);
        }
Ejemplo n.º 3
0
        public override bool Parse(IncomingMessageBuffer buffer)
        {
            FrameSetIndex = buffer.NextIntTriad;

            while (buffer.BytesRemaining >= 4)
            {
                Frame frame = new Frame();
                frame.Decode(ref buffer);
                Frames.Add(frame);
            }

            return(true);
        }
        public override bool Parse(IncomingMessageBuffer buffer)
        {
            byte[] magic = buffer.NextBytes(16);
            if (!IsMagic(magic))
            {
                return(false);
            }

            byte protocolVersion = buffer.NextByte;

            if (protocolVersion == ProtocolMessage.RaknetProtocolVersion)
            {
                IncompatibleProtocol = false;
            }

            NullPayloadLength = (short)(buffer.BytesRemaining + 18);

            return(true);
        }
        public override bool Parse(IncomingMessageBuffer buffer)
        {
            byte[] magic = buffer.NextBytes(16);
            if (!IsMagic(magic))
            {
                return(false);
            }

            ClientNetVersion = buffer.NextByte;
            if (ClientNetVersion != 4)
            {
                return(false);
            }

            ClientAddress = buffer.NextBytes(4);
            ClientPort    = buffer.NextShort;
            MTUSize       = buffer.NextShort;
            ClientID      = buffer.NextULong;

            return(true);
        }
 public override bool Parse(IncomingMessageBuffer buffer)
 {
     PingId = buffer.NextULong;
     byte[] magic = buffer.NextBytes(16);
     return(IsMagic(magic));
 }
Ejemplo n.º 7
0
 public override bool Parse(IncomingMessageBuffer buffer)
 {
     PingID = buffer.NextULong;
     return(true);
 }
 public virtual bool Parse(IncomingMessageBuffer buffer)
 {
     return(false);
 }