Пример #1
0
        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);
            }
        }
Пример #2
0
 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;
 }
Пример #3
0
 public virtual async Task DownloadAsync(CookieAwareWebClient client, string destination, CancellationToken cancellation)
 {
     await client.DownloadFileTaskAsync(Url, destination);
 }