private void btnStart_Click(object sender, RoutedEventArgs e) { lsvCrawlStatus.Items.Clear(); _host.HostName = txtAddress.Text; _crawlSetting.MaxDepth = 1000; Crawler crawler = new Crawler(_crawlSetting, _host, int.Parse(txtThreadNumber.Text)); crawler.CrawlCompleted += crawler_CrawlCompleted; crawler.CrawlAnnounced += crawler_CrawlAnnounced; crawler.CrawlStarted += crawler_CrawlStarted; crawler.Crawl(); }
static void Main(string[] args) { CrawlSetting setting = new CrawlSetting(); setting.MaxDepth = 1000; Host[] hosts=new Host[1]; hosts[0] = new Host(); hosts[0].HostName = "http://salamandroid.ir"; Crawler crawler = new Crawler(setting,hosts,10); crawler.Crawl(); Console.ReadLine(); }
public CrawlStartedEventArgs(Crawler crawler) { this.Crawler = crawler; }
public CrawlCompletedEventArgs(Crawler crawler) { this.Crawler = crawler; }
private void OnCrawlStarted(Crawler crawler) { if (CrawlStarted != null) { CrawlStarted(this, new CrawlStartedEventArgs(crawler)); } }
private void OnCrawlCompleted(Crawler crawler) { Console.WriteLine(crawler._crawlSetting.StartTime.Value.ToShortTimeString()); Console.WriteLine(crawler._crawlSetting.FinishTime.Value.ToShortTimeString()); if (CrawlCompleted != null) { CrawlCompleted(this, new CrawlCompletedEventArgs(crawler)); } }