Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public CrawlStartedEventArgs(Crawler crawler)
 {
     this.Crawler = crawler;
 }
 public CrawlCompletedEventArgs(Crawler crawler)
 {
     this.Crawler = crawler;
 }
Esempio n. 5
0
 private void OnCrawlStarted(Crawler crawler)
 {
     if (CrawlStarted != null)
     {
         CrawlStarted(this, new CrawlStartedEventArgs(crawler));
     }
 }
Esempio n. 6
0
 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));
     }
 }