public void SpiderThread() { if (begin.Text.Equals("Cancel")) { m_spider.Quit = true; begin.Enabled = false; } else { begin.Text = "Cancel"; targetURL.Enabled = false; threadCount.Enabled = false; outputDir.Enabled = false; m_spider = new Spider.Engine.Spider(); m_spider.ReportTo = this; m_spider.OutputPath = outputDir.Text; int threads = int.Parse(threadCount.Text); if (threads < 1) { threads = 1; } threadCount.Text = "" + threads; try { m_spider.Start(new Uri(this.targetURL.Text), threads); } catch (UriFormatException ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return; } begin.Text = "Begin"; targetURL.Enabled = true; threadCount.Enabled = true; outputDir.Enabled = true; begin.Enabled = true; } }
/// <summary> /// Constructor. /// </summary> /// <param name="spider">The spider that owns this worker.</param> public DocumentWorker(Spider spider) { m_spider = spider; }
public void SpiderThread() { if( begin.Text.Equals("Cancel") ) { m_spider.Quit = true; begin.Enabled = false; } else { begin.Text = "Cancel"; targetURL.Enabled = false; threadCount.Enabled = false; outputDir.Enabled = false; m_spider = new Spider.Engine.Spider(); m_spider.ReportTo = this; m_spider.OutputPath = outputDir.Text; int threads = int.Parse( threadCount.Text); if(threads<1) threads = 1; threadCount.Text = ""+threads; try { m_spider.Start(new Uri(this.targetURL.Text),threads); } catch( UriFormatException ex) { System.Windows.Forms.MessageBox.Show( ex.Message ); return; } begin.Text = "Begin"; targetURL.Enabled = true; threadCount.Enabled = true; outputDir.Enabled = true; begin.Enabled = true; } }