public override void Encode(Stream outputStream, bool withHeader = true) { if (outputStream == null || !outputStream.CanWrite) { return; } if (withHeader) { NetworkMessageHeader.Encode(outputStream); } PayloadHeader.Encode(outputStream); BaseType.WriteToStream(outputStream, BitConverter.GetBytes(MessageSequenceNumber)); BaseType.WriteToStream(outputStream, BitConverter.GetBytes(ChunkOffset)); BaseType.WriteToStream(outputStream, BitConverter.GetBytes(TotalSize)); int length = -1; if (ChunkData != null) { length = ChunkData.Length; } BaseType.WriteToStream(outputStream, BitConverter.GetBytes(length)); for (int i = 0; i < length; i++) { // ReSharper disable once PossibleNullReferenceException outputStream.WriteByte(ChunkData[i]); } }
public override void Encode(Stream outputStream, bool withHeader = true) { if (outputStream == null || !outputStream.CanWrite) { return; } if (withHeader) { NetworkMessageHeader.Encode(outputStream); } EncodeChunk(outputStream); }
public override void Encode(Stream outputStream, bool withHeader = true) { if (outputStream == null || !outputStream.CanWrite) { return; } if (withHeader) { // 1. Network Message Header NetworkMessageHeader.Encode(outputStream); } // 2. DataSet Payload Header PayloadHeader.Encode(outputStream); EncodeChunk(outputStream); }