Beispiel #1
0
        public override byte[] ToByteArray()
        {
            OutgoingMessageBuffer buffer = new OutgoingMessageBuffer();

            buffer.InsertValue(mMessageType);
            buffer.InsertValue(mTheMagicNumber);
            buffer.InsertValue(Network.MessageHandler.Instance.ServerId);
            buffer.InsertValue((byte)0);
            buffer.InsertValue(MTU);
            return(buffer.GetBytes());
        }
        public override byte[] ToByteArray()
        {
            OutgoingMessageBuffer buffer = new OutgoingMessageBuffer();

            buffer.InsertValue(mMessageType);
            buffer.InsertValue(FrameSetIndex, true);

            foreach (Frame f in Frames)
            {
                buffer.InsertValue(f.ToByteArray());
            }

            return(buffer.GetBytes());
        }
        public override byte[] ToByteArray()
        {
            OutgoingMessageBuffer buffer = new OutgoingMessageBuffer();

            buffer.InsertValue(mMessageType);
            return(buffer.GetBytes());
        }
Beispiel #4
0
        public byte[] ToByteArray()
        {
            OutgoingMessageBuffer buffer = new OutgoingMessageBuffer();
            byte flags = (byte)(((byte)Reliability << 5) | (IsSplit ? 0x10 : 0));

            buffer.InsertValue(flags);

            short payloadBits = (short)(Payload.Length * 8);

            buffer.InsertValue(payloadBits);

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

            if (Reliability == ReliabilityStatus.UNRELIABLE_SEQUENCED ||
                Reliability == ReliabilityStatus.RELIABLE_SEQUENCED ||
                Reliability == ReliabilityStatus.RELIABLE_ORDERED)
            {
                buffer.InsertValue(OrderIndex, true);
                buffer.InsertValue(OrderChannel);
            }

            if (IsSplit)
            {
                buffer.InsertValue(SplitCount);
                buffer.InsertValue(SplitID);
                buffer.InsertValue(SplitIndex);
            }

            buffer.InsertValue(Payload);
            return(buffer.GetBytes());
        }
        public override byte[] ToByteArray()
        {
            OutgoingMessageBuffer buffer = new OutgoingMessageBuffer();

            buffer.InsertValue(mMessageType);
            buffer.InsertValue(new byte[] { 0, 0 });
            buffer.InsertValue(new IPEndPoint(IPAddress.Loopback, 0));
            for (int i = 0; i < 9; i++)
            {
                buffer.InsertValue(new IPEndPoint(0, 0));
            }

            buffer.InsertValue(SendPing);
            buffer.InsertValue(SendPong);
            return(buffer.GetBytes());
        }