コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public ProgressReportingHttpContent(Stream content, TransferProgressReporter reporter) : this(content,
                                                                                               defaultBufferSize, reporter)
 {
 }