private void Start() { if (isProxyCb.Checked && ips == null) { // 需要获取代理访问 GetProxy(); } AllControlStatus(false); string[,] matches = null; try { WebProxy proxy = isProxyCb.Checked ? new WebProxy(this.ips[this.ip], String2Port(ports[this.port])) : null; ChangeStatus("正在请求..."); matches = yande.GetPageImage(page, proxy); } catch (Exception ex) { if (!isProxyCb.Checked) { Stop(); } ip++; port++; ChangeStatus("请求错误:" + ex.Message); } if (matches != null) { timerNum++; if ((endPageTxt.Value != 0 && page >= (int)endPageTxt.Value) || matches.Length == 0) { // 执行到最后一页 if ((tagIndex + 1) >= tagsTxt.Lines.Length) { // 执行到最后tag,结束任务 Stop(); } else { tagIndex++; yande.ChangeTag(tagsTxt.Lines[tagIndex]); } } for (int i = 0; i < matches.Length / 4; i++) { if (timer == null) { break; } ChangeStatus("正在下载" + tagsTxt.Lines[tagIndex] + (i + 1) + "/" + matches.Length / 4); DownloadFile(matches[i, 1]); } page++; startBtn.Enabled = true; AllControlStatus(true); } }