static void Main(string[] args) { Spider spider = CreateSpider(); string url = ReadInitialUrl(); if (String.IsNullOrWhiteSpace(url)) { spider.Start(); } else { spider.Start(url); } }
public void SpiderThread2() { if (begin2.Text.Equals("停止下载图片")) { spider.Quit = true; begin2.Enabled = false; } else { begin2.Text = "停止下载图片"; begin1.Enabled = false; targetURL.Enabled = false; threadCount.Enabled = false; output.Enabled = false; spider = new Spider(); spider.MainForm = this; spider.Output = output.Text; int threads = Convert.ToInt32(threadCount.Text); if (threads <= 1) { threads = 2; } threadCount.Text = threads.ToString(); spider.Flag = 1; spider.Start(new Uri(this.targetURL.Text), threads); begin2.Text = "开始下载图片"; begin2.Enabled = true; begin1.Enabled = true; targetURL.Enabled = true; threadCount.Enabled = true; output.Enabled = true; } }
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(); 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; } }
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(); 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; } }