} // proc WriteText /// <summary>Writes the stream to the output.</summary> /// <param name="context"></param> /// <param name="stream"></param> /// <param name="contentType"></param> public static void WriteStream(this IDEContext context, Stream stream, string contentType = MimeTypes.Application.OctetStream) { var length = stream.CanSeek ? stream.Length : -1L; using (var dst = context.GetOutputStream(contentType, length)) stream.CopyTo(dst); } // proc WriteStream
} // proc WriteText /// <summary>Writes the bytes to the output.</summary> /// <param name="context"></param> /// <param name="value"></param> /// <param name="contentType"></param> public static void WriteBytes(this IDEContext context, byte[] value, string contentType = MimeTypes.Application.OctetStream) { using (var dst = context.GetOutputStream(contentType, value.Length)) dst?.Write(value, 0, value.Length); } // proc WriteText
private void OpenBinary(string sContentType, Encoding encoding = null) { PrepareOutput(); streamOutput = context.GetOutputStream(contentType); } // proc OpenBinary