Esempio n. 1
0
 protected virtual async Task DownloadAsyncInternal(FileDownloadSpec spec)
 {
     ConfirmStrategySupported(spec.Uri);
     spec.LocalFile.RemoveReadonlyWhenExists();
     try {
         await GetStrategy(spec.Uri).DownloadAsync(spec).ConfigureAwait(false);
     } finally {
         ResetSpec(spec);
     }
 }
Esempio n. 2
0
 protected virtual void DownloadInternal(FileDownloadSpec spec)
 {
     ConfirmStrategySupported(spec.Uri);
     spec.LocalFile.RemoveReadonlyWhenExists();
     try {
         GetStrategy(spec.Uri).Download(spec);
     } catch {
         ResetSpec(spec);
     }
 }
Esempio n. 3
0
 FileDownloadSpec GetSpec(FileDownloadSpec spec) => spec.Progress == null
     ? new FileDownloadSpec(_authProvider.HandleUri(spec.Uri), spec.LocalFile)
 {
     Verification      = spec.Verification,
     CancellationToken = spec.CancellationToken,
     ExistingFile      = spec.ExistingFile
 }
     : new FileDownloadSpec(_authProvider.HandleUri(spec.Uri), spec.LocalFile, spec.Progress)
 {
     Verification      = spec.Verification,
     CancellationToken = spec.CancellationToken,
     ExistingFile      = spec.ExistingFile
 };
 public Task DownloadAsync(FileDownloadSpec spec) => Wrap(() => _downloader.DownloadAsync(spec), spec);
 public void Download(FileDownloadSpec spec)
 {
     Wrap(() => _downloader.Download(spec), spec);
 }
Esempio n. 6
0
 private void ResetSpec(FileDownloadSpec spec) => spec.Progress?.Update(null, 100);
Esempio n. 7
0
 public Task DownloadAsync(FileDownloadSpec spec) => DownloadAsyncInternal(GetSpec(spec));
Esempio n. 8
0
 public void Download(FileDownloadSpec spec) => DownloadInternal(GetSpec(spec));