private void _btnStartFolder_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(folderBrowser.SelectedPath)) { _lblDir.Text = "Select a dir, dork"; return; } string[] files = Directory.GetFiles(folderBrowser.SelectedPath, "*.txt", SearchOption.AllDirectories); _resultAction = new Action <IRequest>(Write); _pageCounterAction = new Action(UpdateSiteCount); FileSaver.FileName = "SocialiteFindings-" + DateTime.Now.ToString("MM-dd-yyyy-hh-mm-ss") + ".txt"; foreach (string file in files) { string[] lines = File.ReadAllLines(file); foreach (string line in lines) { if (String.IsNullOrEmpty(line)) { continue; } CrawlerContext.Initialize(); CrawlerContext.LightMode = true; CrawlerContext.Depth = 4; CrawlerContext.SetURL(line); Crawler.CrawlSite(_resultAction, _pageCounterAction); } } }
private void _bgwScanner_DoWork(object sender, DoWorkEventArgs e) { try { // CrawlerContext.SessionFileName = "Scraper"; // Core.SQLite.Accessor.Settings.ConnectionString = "data source=" + CrawlerContext.SessionFileName; CrawlerContext.SetURL(_txtURL.Text); _resultAction = new Action <IRequest>(Write); _pageCounterAction = new Action(UpdateSiteCount); Crawler.CrawlSite(_resultAction, _pageCounterAction); //LinearCrawler.CrawlSite(DataGridWrite, SiteCounter); } catch (Exception ex) { MessageBox.Show("Scanner Error: " + ex.Message); } }