public override void Scrape(ScrapeParameters parameters, object state) { }
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)); }
public ConnectScrapeState(ScrapeParameters parameters, AsyncCallback callback, object state) : base(callback, state) { Parameters = parameters; }
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); }
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"); }
public abstract void Scrape(ScrapeParameters parameters, object state);