private void btnstart_Click(object sender, EventArgs e) { if (userList.Count <= 0) { MessageBox.Show("请导入用户账号"); return; } btnstart.Enabled = false; int spiderNum = 0; int xmlnamenum = 0; tm.Start(); if (useproxy.Checked) { if (IPList.Count < 0) { MessageBox.Show("ip列表为空,请到ip.xml编辑"); return; } _IP iP = getip(); httpClient = new HttpClient(iP.ip.Split(':')[0].ToString(), Convert.ToInt32(iP.ip.Split(':')[1].ToString()), useproxy.Checked); } else { httpClient = new HttpClient("", 0, useproxy.Checked); } if (url_comb.Text == "全部") { Thread cyth = new Thread(spidercymain); cyth.Start(); Thread hyth = new Thread(spiderhymain); hyth.Start(); Thread ccda = new Thread(spiderccdamain); ccda.Start(); } else if (url_comb.Text == "船源") { Thread cyth = new Thread(spidercymain); cyth.Start(); } else if (url_comb.Text == "货源") { Thread hyth = new Thread(spiderhymain); hyth.Start(); } else if (url_comb.Text == "船舶档案") { Thread ccda = new Thread(spiderccdamain); ccda.Start(); } }
public _IP getip() { _IP ip = new _IP(); ip = Program.IPList.Take(); Program.IPList.Add(ip); return(ip); }
public ProxyEntity GetProxyEntity_URL2() { Configuration.ProxyEntity proxyDetailEntity = new Configuration.ProxyEntity(); _IP ip = getip(); proxyDetailEntity.IsProxy = true; proxyDetailEntity.proxyAddess = ip.ip; proxyDetailEntity.proxyUid = ""; proxyDetailEntity.proxyPwd = ""; proxyDetailEntity.msmqMsgPath = ""; return(proxyDetailEntity); }
public void getHttpClient() { if (useproxy.Checked) { if (IPList.Count < 0) { MessageBox.Show("ip列表为空,请到ip.xml编辑"); return; } _IP iP = getip(); txtview.AppendText("切换代理" + iP.ip + "" + Environment.NewLine); httpClient = new HttpClient(iP.ip.Split(':')[0].ToString(), Convert.ToInt32(iP.ip.Split(':')[1].ToString()), useproxy.Checked); } else { httpClient = new HttpClient("", 0, useproxy.Checked); } }
public _IP getip() { _IP ip = new _IP(); for (int i = 0; i < IPList.Count; i++) { if (IPList[i].ip != "") { ip = IPList[i]; IPList.Remove(ip); IPList.Add(ip); break; } else { IPList.Remove(IPList[i]); } } return(ip); }