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; }
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); } }
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; }
public override Task DownloadAsync(FileQueueSpec spec, CancellationToken token) { return spec.Files.StartConcurrentTaskQueue(token, file => Downloader.DownloadAsync(GetDlSpec(spec, file, token), token), _getMaxThreads); }
public override Task DownloadAsync(FileQueueSpec spec) { return spec.Files.StartConcurrentTaskQueue( file => Downloader.DownloadAsync(GetDlSpec(spec, file)), _getMaxThreads); }
public virtual async Task DownloadAsync(FileQueueSpec spec) { foreach (var file in spec.Files) { await Downloader.DownloadAsync(GetDlSpec(spec, file)).ConfigureAwait(false); } }