public Task GetEntryContentAsync(SyncContext context, StateSyncEntry entry, Stream output, SyncGetEntryContentOptions options = null) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (entry == null) { throw new ArgumentNullException(nameof(entry)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } options = options ?? new SyncGetEntryContentOptions(); var webViewLink = entry.GetNullifiedExtendedDataValue("WebViewLink"); Account.Log(TraceLevel.Verbose, "offset:" + options.Offset + " count:" + options.Count + " webViewLink:" + webViewLink); if (webViewLink != null) { var content = GetUrlFileContent(webViewLink); return(output.WriteAsync(content, (int)options.Offset, (int)Math.Min(options.Count, content.Length))); } var sink = context.ProgressSink; if (sink == null) { return(Account.DownloadFileAsync(entry.Id, options.Offset, options.Count, output, options.CancellationToken)); } return(Account.DownloadFileAsync(entry.Id, options.Offset, options.Count, output, options.CancellationToken, (p) => { sink.Progress(context, entry.Size, p.BytesDownloaded); })); }
public Task GetEntryContentAsync(SyncContext context, StateSyncEntry entry, Stream output, SyncGetEntryContentOptions options = null) { var item = new WebItem { Id = ToId(entry.Id) }; if (item.Id == Guid.Empty) { return(Task.CompletedTask); } return(item.DownloadAsync(output, context)); }