public Task <INode> UploadAsync(Stream stream, string name, INode parent, IProgress <double> progress) { return(Task.Run(() => { if (stream == null) { throw new ArgumentNullException("stream"); } using (Stream progressionStream = new ProgressionStream(stream, progress, this.ReportProgressChunkSize)) { return this.Upload(progressionStream, name, parent); } })); }
public Task <INode> UploadAsync(Stream stream, string name, INode parent, IProgress <double> progress = null, DateTime?modificationDate = null, CancellationToken?cancellationToken = null) { return(Task.Run(() => { if (stream == null) { throw new ArgumentNullException("stream"); } using (Stream progressionStream = new ProgressionStream(stream, progress, _options.ReportProgressChunkSize)) { return Upload(progressionStream, name, parent, modificationDate, cancellationToken); } }, cancellationToken.GetValueOrDefault())); }
public Task DownloadFileAsync(Uri uri, string outputFile, IProgress <double> progress) { return(Task.Run(() => { if (string.IsNullOrEmpty(outputFile)) { throw new ArgumentNullException("outputFile"); } using (Stream stream = new ProgressionStream(this.Download(uri), progress, this.ReportProgressChunkSize)) { this.SaveStream(stream, outputFile); } })); }
public Task DownloadFileAsync(Uri uri, string outputFile, IProgress <double> progress = null, CancellationToken?cancellationToken = null) { return(Task.Run(() => { if (string.IsNullOrEmpty(outputFile)) { throw new ArgumentNullException("outputFile"); } using (Stream stream = new ProgressionStream(Download(uri, cancellationToken), progress, _options.ReportProgressChunkSize)) { SaveStream(stream, outputFile); } }, cancellationToken.GetValueOrDefault())); }