public override void Scrape(ScrapeParameters parameters, object state)
 {
 }
Example #2
0
 public override void Scrape(ScrapeParameters parameters, object state)
 {
     RaiseBeforeScrape();
     ScrapedAt.Add(DateTime.Now);
     RaiseScrapeComplete(new ScrapeResponseEventArgs(this, state, !FailScrape));
 }
 public override void Scrape(ScrapeParameters parameters, object state)
 {
     RaiseScrapeComplete(new ScrapeResponseEventArgs(this, state, true));
 }
Example #4
0
 public ConnectScrapeState(ScrapeParameters parameters, AsyncCallback callback, object state)
     : base(callback, state)
 {
     Parameters = parameters;
 }
Example #5
0
        private void OfflineScrapeTest()
        {
            var udpTracker = (UdpTracker) TrackerFactory.Create(new Uri("udp://127.0.0.1:57532/announce"));
            udpTracker.RetryDelay = TimeSpan.FromMilliseconds(500);
            var id = new TrackerConnectionID(udpTracker, false, TorrentEvent.Started, new ManualResetEvent(false));

            ScrapeResponseEventArgs p = null;
            udpTracker.ScrapeComplete += (o, e) =>
                                             {
                                                 if (e.Successful)
                                                     Console.ReadLine();
                                                 p = e;
                                                 id.WaitHandle.Set();
                                             };
            var pars = new ScrapeParameters(new InfoHash(new byte[20]));

            udpTracker.Scrape(pars, id);
            Wait(id.WaitHandle);
            Assert.IsNotNull(p, "#1");
            Assert.IsFalse(p.Successful);
        }
Example #6
0
        public void ScrapeTest()
        {
            var udpTracker = (UdpTracker) TrackerFactory.Create(new Uri(Prefix));
            Assert.IsTrue(udpTracker.CanScrape, "#1");

            var id = new TrackerConnectionID(udpTracker, false, TorrentEvent.Started, new ManualResetEvent(false));

            ScrapeResponseEventArgs p = null;
            udpTracker.ScrapeComplete += delegate(object o, ScrapeResponseEventArgs e)
                                             {
                                                 p = e;
                                                 id.WaitHandle.Set();
                                             };
            var pars = new ScrapeParameters(new InfoHash(new byte[20]));

            udpTracker.Scrape(pars, id);
            Wait(id.WaitHandle);
            Assert.IsNotNull(p, "#2");
            Assert.IsTrue(p.Successful, "#3");
            Assert.AreEqual(0, udpTracker.Complete, "#1");
            Assert.AreEqual(0, udpTracker.Incomplete, "#2");
            Assert.AreEqual(0, udpTracker.Downloaded, "#3");
        }
Example #7
0
 public abstract void Scrape(ScrapeParameters parameters, object state);
Example #8
0
 public abstract void Scrape(ScrapeParameters parameters, object state);