public override async Task DownloadAsync(CookieAwareWebClient client, string destination, CancellationToken cancellation) { if (OptionFailImmediately) { throw new NotSupportedException(); } using (client.SetProxy(SettingsHolder.Content.RdProxy)) { await client.DownloadFileTaskAsync(Url, destination); } }
private async Task<string> DownloadClientAsync([NotNull] CookieAwareWebClient client, [NotNull] FlexibleLoaderGetPreferredDestinationCallback getPreferredDestination, [CanBeNull] FlexibleLoaderReportDestinationCallback reportDestination, [CanBeNull] Func<bool> checkIfPaused, CancellationToken cancellation) { cancellation.Register(client.CancelAsync); var information = FlexibleLoaderMetaInformation.FromLoader(this); var destination = getPreferredDestination(Url, information); var filename = FileUtils.EnsureUnique(true, destination.Filename); reportDestination?.Invoke(filename); await client.DownloadFileTaskAsync(Url, filename).ConfigureAwait(false); return filename; }
public virtual async Task DownloadAsync(CookieAwareWebClient client, string destination, CancellationToken cancellation) { await client.DownloadFileTaskAsync(Url, destination); }