コード例 #1
0
 protected static MultiMirrorFileDownloadSpec GetDlSpec(FileQueueSpec spec,
     KeyValuePair<KeyValuePair<string, Func<IAbsoluteFilePath, bool>>, ITransferStatus> file,
     CancellationToken token) {
     var dlSpec = GetDlSpec(spec, file);
     dlSpec.CancellationToken = token;
     return dlSpec;
 }
コード例 #2
0
        public virtual async Task DownloadAsync(FileQueueSpec spec, CancellationToken token) {
            foreach (var file in spec.Files) {
                token.ThrowIfCancellationRequested();

                await
                    Downloader.DownloadAsync(GetDlSpec(spec, file, token), token).ConfigureAwait(false);
            }
        }
コード例 #3
0
 protected static MultiMirrorFileDownloadSpec GetDlSpec(FileQueueSpec spec,
     KeyValuePair<KeyValuePair<string, Func<IAbsoluteFilePath, bool>>, ITransferStatus> file) {
     var dlSpec = new MultiMirrorFileDownloadSpec(file.Key.Key, spec.Location.GetChildFileWithName(file.Key.Key)) {
         Progress = file.Value,
         Verification = file.Key.Value
     };
     dlSpec.LocalFile.MakeSureParentPathExists();
     return dlSpec;
 }
コード例 #4
0
 public override Task DownloadAsync(FileQueueSpec spec, CancellationToken token) {
     return spec.Files.StartConcurrentTaskQueue(token,
         file => Downloader.DownloadAsync(GetDlSpec(spec, file, token), token), _getMaxThreads);
 }
コード例 #5
0
 public override Task DownloadAsync(FileQueueSpec spec) {
     return spec.Files.StartConcurrentTaskQueue(
         file => Downloader.DownloadAsync(GetDlSpec(spec, file)), _getMaxThreads);
 }
コード例 #6
0
 public virtual async Task DownloadAsync(FileQueueSpec spec) {
     foreach (var file in spec.Files) {
         await
             Downloader.DownloadAsync(GetDlSpec(spec, file)).ConfigureAwait(false);
     }
 }