public void Enqueue(Uri url) { if(!_cache.Contains(url)) { _cache.Add(url); var fetcher = new Downloader(url); _queue.Enqueue(fetcher); } }
/// <summary> /// Enqueue a new downloader. /// </summary> /// <param name="downloader">Downloader to enqueue.</param> public void Enqueue(Downloader downloader) { lock (_mutex) { if (_queue.All(x => x.Url.AbsoluteUri != downloader.Url.AbsoluteUri)) { _queue.Add(downloader); } } }
/// <summary> /// Remove a downloader from both the executing list and queue. /// </summary> /// <param name="downloader"></param> private void RemoveFetcher(Downloader downloader) { lock (_mutex) { _executing.Remove(downloader); _queue.Remove(downloader); } }
protected bool Equals(Downloader other) { return Equals(Url, other.Url); }
protected bool Equals(Downloader other) { return(Equals(Url, other.Url)); }