public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (buffer.Length != count) { return(_pipeNetworkStream.WriteAsync(buffer.Take(count).ToArray(), offset, count)); } else { return(_pipeNetworkStream.WriteAsync(buffer, offset, count)); } }
public override Task WriteToStreamAsync(PipeNetworkStream stream, byte[] data) #endif { #if (NET35 || NET40) stream.Write(data, 0, data.Length); #else return(stream.WriteAsync(data, 0, data.Length)); #endif }
public Task WriteBlockToStreamAsync(PipeNetworkStream stream, byte[] data) { byte[] size = BitConverter.GetBytes(data.Length); return(stream.WriteAsync(size, 0, size.Length).ContinueWith((t) => stream.WriteAsync(data, 0, data.Length))); }
public virtual Task WriteToStreamAsync(PipeNetworkStream stream, byte[] data) { return(stream.WriteAsync(data, 0, data.Length)); }