Exemple #1
0
        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);
     }
 }
Exemple #4
0
 protected bool Equals(Downloader other)
 {
     return Equals(Url, other.Url);
 }
Exemple #5
0
 protected bool Equals(Downloader other)
 {
     return(Equals(Url, other.Url));
 }