public void dealRegcsdn(string[] str,CsdnHelper cs=null ) { if (str != null) { if (str.Length == 1) { showlogs(DateTime.Now.ToString("HHmmssffff") + "\t操作出错\t"+str[0]); //showlogs("注册失败:" + str[0]); } else if(str .Length ==2) { this.Invoke(new Action(() => { txtUser.Text = str[0]; txtPass.Text = str[1]; btn_Login(cs ); // btnLogin_Click(null, null); })); } } }
private void btn_reg_Click(object sender, EventArgs e) { CsdnHelper ctmp=new CsdnHelper(); ctmp.getImgVcode += new CsdnHelper.GetImgVcode(getVcode); ctmp.showLogs += new CsdnHelper.ShowLogs(showlogs); ctmp.regeristResult += new CsdnHelper.RegeristResult(dealRegcsdn); ctmp.getRegVcode += new CsdnHelper.GetRegVcode(getRegVcode); string regPass = ""; regPass = txt_regPass.Text.Trim() == "" ? "yqmacCSDN" : txt_regPass.Text.Trim(); ctmp.ComMsg = msgs; ctmp.AutoRunTocheck(regPass, 1); //ctmp = null; }
private void btn_Login(CsdnHelper cs=null ) { string user = ""; string pass = ""; if (cs!=null &&cs.User != null) { user = cs.User; pass = cs.Pass; }else { user = txtUser.Text.Trim(); pass = txtPass.Text; } if (!users.ContainsKey(user )) { users.Add(user,pass ); //userColor.Add(txtUser.Text.Trim(), GetRandomColor()); ListViewItem lvi = new ListViewItem(); lvi.Text = listView1.Items.Count.ToString(); lvi.SubItems.Add(user); lvi.SubItems.Add(pass); lvi.SubItems.Add("未登录"); if (cs != null) { lvi.Tag = cs; } //lvi .ForeColor =userColor [txtUser.Text .Trim ()]; //lvi.Tag = cdh; int index = listView1.Items.Add(lvi).Index ; if(cs !=null ) { LoginTest(user , pass, index); } //CsdnHelper cdh = new CsdnHelper(txtUser.Text.Trim(), txtPass.Text); } }
private void btn_auto_Click(object sender, EventArgs e) { // CsdnResouce csdn = new CsdnResouce(); CsdnHelper csdn = new CsdnHelper(); csdn.getImgVcode += new CsdnHelper.GetImgVcode (getVcode ); csdn.showLogs += new CsdnHelper.ShowLogs (showlogs); csdn.regeristResult +=new CsdnHelper.RegeristResult ( dealRegcsdn); csdn.getRegVcode += new CsdnHelper.GetRegVcode (getRegVcode ); csdn.ComMsg = msgs; string regPass=""; int regNum = 1; regPass = txt_regPass.Text.Trim() == "" ? "yqmacCSDN" : txt_regPass.Text.Trim(); int.TryParse(txt_regNum .Text .Trim (),out regNum ); regNum=regNum == 0 ? 1 : regNum; csdn.AutoRunTocheck(regPass ,regNum ); }
public void LoginTest(string user, string pass,int index) { for (int i = 0; i < listCsdnH.Count; i++) { if (listCsdnH[i].User == user) { return; } } CsdnHelper cdh = null; bool tag = false; this.Invoke(new Action(() => { if (listView1.Items[index].Tag != null) { tag = true; cdh = (CsdnHelper)listView1.Items[index].Tag; } })); if (!tag) { cdh = new CsdnHelper(user, pass); cdh.getImgVcode += new CsdnHelper.GetImgVcode(getVcode); cdh.showLogs += new CsdnHelper.ShowLogs(showlogs); cdh.regeristResult += new CsdnHelper.RegeristResult(dealRegcsdn); cdh.getRegVcode += new CsdnHelper.GetRegVcode(getRegVcode); cdh.ComMsg = msgs; } string sta = ""; if ((sta=cdh.Login()).Contains("成功")) { if (!userColor.ContainsKey(cdh.NickName)) { userColor.Add(cdh.NickName, GetRandomColor()); listCsdnH.Add(cdh); } //cdh.Command(); this.Invoke(new Action(() => { this.listView1.Items[index].SubItems[3].Text = "登录成功:"+cdh .NickName ; this.listView1.Items[index].Tag = cdh; this.listView1.Items[index].ForeColor =userColor [cdh .NickName ]; })); }else { cdh = null; this.Invoke(new Action(() => { this.listView1.Items[index].SubItems[3].Text = sta ; //this.listView1.Items[index].Tag = cdh; })); } }
public FormSetting(CsdnHelper cdhp) { InitializeComponent(); this.cdhp = cdhp; }