/// <summary> /// Starts/Resumes the downloads of this manager /// </summary> public void Start() { foreach (var dl in Pending.Take(MaxParallelDownloads - RunningDownloads.Count())) { dl.StartAsync(); } ApplyDownloadLimits(); }
/// <summary> /// Pauses all currently running downloads /// </summary> public void Pause() { Console.WriteLine(RunningDownloads.Count()); foreach (var dl in RunningDownloads) { dl.Pause(); } }
private void ApplyDownloadLimits() { if (RunningDownloads.Count() < 1) { return; } int limit = BandwidthLimit / RunningDownloads.Count(); foreach (IDownloader dl in RunningDownloads) { dl.BandwidthLimit = limit; } }