/// <summary> /// 判断一个抽奖列表中分组信息是否正确、返回0 为正确反之不正确 /// </summary> /// <param name="ListText">列表信息文本</param> /// <param name="MoShi">0:魔盒/1:袖珍罐/2:礼包/3:抽奖机</param> /// <param name="FenZu">魔盒:4/袖珍罐:3/礼包:3|5/抽奖机:4</param> /// <returns></returns> public int YesNoGeShi(string ListText, int MoShi, int FenZu) { int Info = 0; Regex_new regex = new Regex_new(); switch (MoShi) { case 0: regex.创建(ListText, "\t", 0); Info = regex.取匹配数量() % FenZu; break; case 1: regex.创建(ListText.Substring(ListText.IndexOf("\t", ListText.IndexOf("\t") + 1) + 1), "\t", 0); Info = regex.取匹配数量() % FenZu; break; case 2: regex.创建(ListText.Substring(ListText.IndexOf("\t") + 1), "\t", 0); Info = regex.取匹配数量() % FenZu; break; case 3: regex.创建(ListText, "\t", 0); Info = regex.取匹配数量() % FenZu; break; } return(Info); }
//设置QQ群号码后会进入此处并且会验证群号码以及QQ号 private void WebBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) { if (webBrowser1 != null) { if (webBrowser1.Url != null) { if (webBrowser1.Url.ToString().StartsWith("http://qun.qzone.qq.com")) { webBrowser1.Visible = false; HtmlElement groupList = webBrowser1.Document.GetElementById("my_group_list_container"); if (groupList == null) { return; } webBrowser1.ProgressChanged -= WebBrowser1_ProgressChanged; string groupListText = webBrowser1.DocumentText;//获取所有的网站文本 Regex_new regex = new Regex_new(); regex.创建(groupListText, @" uin:(\d+)';", 1); if (regex.取匹配数量() > 0) { string groupid = "759213683"; //得到群号 string QqId = regex.取子匹配文本(1, 1); //得到QQ Form1.MysqlYz.qq = QqId; Form1.MysqlYz.md5 = new Verification().GetMD5String(); //获取机器码 //验证QQ群号码以及QQ号码 if (groupListText.Contains($"data-groupid=\"{ groupid}\"><")) { if (Form1.MysqlYz.ChaXun())//数据库中查询成功 { Form1.MysqlYz.ChaR(); MessageBox.Show("尊敬的大佬,请尽情使用强大的功能吧~", "验证成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Form1.MysqlYz.Yse(); //恢复窗体正常 Close(); //关闭子窗口 } else { new Verification().End(); Close(); } } else { CuoWu(); } } else { CuoWu(); } } } } }