Example #1
0
        public void ToStream(ref ByteOutputStream writer)
        {
            QueryHeader.ToStream(ref writer);

            var start = (ushort)writer.GetBytePosition();

            writer.WriteUInt32_NBO(0); // ChunkLen

            var chunkStart = (uint)writer.GetBytePosition();

            ServerInfoData.ToStream(ref writer);
            ChunkLen           = (uint)writer.GetBytePosition() - chunkStart;
            QueryHeader.Length = (ushort)(writer.GetBytePosition() - start);

            const int LengthSize     = 2;
            const int LengthOffset   = 9;
            const int ChunkLenSize   = 4;
            const int ChunkLenOffset = 11;

            var length   = (ushort)System.Net.IPAddress.HostToNetworkOrder((short)QueryHeader.Length);
            var chunkLen = (uint)System.Net.IPAddress.HostToNetworkOrder((int)ChunkLen);

            writer.WriteBytesOffset(new byte[] { (byte)length, (byte)(length >> 8) }, 0, LengthOffset, LengthSize);
            writer.WriteBytesOffset(new byte[] { (byte)chunkLen, (byte)(chunkLen >> 8), (byte)(chunkLen >> 16), (byte)(chunkLen >> 24) }, 0, ChunkLenOffset, ChunkLenSize);
        }
Example #2
0
 public void ToStream(ref ByteOutputStream writer)
 {
     writer.WriteUInt8(Type);
     writer.WriteUInt32_NBO(ChallangeId);
 }