public ProgressReportingHttpContent(Stream content, int bufferSize, TransferProgressReporter reporter) { if (content == null) { throw new ArgumentNullException("content"); } if (bufferSize <= 0) { throw new ArgumentOutOfRangeException("bufferSize"); } _content = content; _bufferSize = bufferSize; _reporter = reporter; }
public async Task <bool> PUT(WebDAVLocation location, string filename, Stream contents, TransferProgressReporter.ReportProgressHandler progressHandler = null) { _logger.LogDebug("Putting file {Location}/{Filename}", location, filename); var uri = getUrlForFilename(location.Value, filename); var reporter = new TransferProgressReporter(); if (progressHandler != null) { reporter.Handler += progressHandler; } var httpContent = new ProgressReportingHttpContent(contents, reporter); var result = await GetClient().PutAsync(uri, httpContent).ConfigureAwait(false); return(result.IsSuccessStatusCode); }
public ProgressReportingHttpContent(Stream content, TransferProgressReporter reporter) : this(content, defaultBufferSize, reporter) { }