public void SetPhoneCodeCallBack(MobileMgr mobileMgr, MobileModel mobileModel)
 {
     this.HySeleniumMgr.GetPhoneSms = (string phone, string quHao) => {
         string sms = MobileMgr.GetYzm(mobileMgr.getVcodeAndHoldMobilenum(mobileModel), 6);
         if (sms.IsNullOrWhiteSpace())
         {
             mobileMgr.cancelSMSRecv(mobileModel.PhoneNumber);
         }
         return(sms);
     };
 }
        private bool OneReg()
        {
            bool flag;

            FiddlerProxyLogic.GetProxy(null);
            base.GeRegJqm();
            base.HySeleniumMgr = new FiddlerHandle.AutoWeb.HySeleniumMgr();
            MobileMgr   mobileMgr = new MobileMgr(this.ptType);
            MobileModel mobilenum = null;

            while (true)
            {
                mobilenum = mobileMgr.GetMobilenum(null);
                if ((mobilenum == null ? false : !mobilenum.PhoneNumber.IsNullOrWhiteSpace()))
                {
                    break;
                }
                XTrace.WriteLine("手机号码获取不到!~~");
            }
            ConvertMy.toInt(mobilenum.PhoneNumber.Cut(3, null));
            XTrace.WriteLine(string.Concat("合适的手机号码 ", mobilenum.PhoneNumber));
            HyAccount acount = HyAccount.FindByPhone(mobilenum.PhoneNumber);

            if ((acount == null ? true : acount.Phone.IsNullOrWhiteSpace()))
            {
                base.SetPhoneCodeCallBack(mobileMgr, mobilenum);
                base.HySeleniumMgr.ClearCach(mobilenum.PhoneNumber);
                string password = base.CratePasswor();
                bool   ret      = base.HySeleniumMgr.QuickRegisterHy(mobilenum.PhoneNumber, password, mobilenum.CountryCode);
                if (ret)
                {
                    HyAccount hyAccount = new HyAccount()
                    {
                        UserName = mobilenum.PhoneNumber,
                        UserPass = password,
                        PiHao    = XmlConfig <SeleniumConfig> .Current.PiHao,
                        Enable   = true,
                        RegType  = RegType.HyKuaiSu,
                        BeiZhu   = "测试第六批->www.huya.com 页面登录成功后自动弹出完善资料页面,谷歌浏览器自动化操作快速注册,过极验验证,过检测驱动"
                    };
                    hyAccount.SaveModel(mobilenum);
                    DateTime now = TimerX.Now;
                    hyAccount.CreateTime = now;
                    hyAccount.Save();
                    string jqmStr = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());                   //机器码处理
                    hyAccount.JiQiMa     = jqmStr;
                    hyAccount.UpdateTime = now.AddDays(-1);
                    hyAccount.Save();
                    mobileMgr.reslut(mobilenum.PhoneNumber, true);
                    XTrace.WriteLine(string.Concat(new string[] { "快速注册成功 ", hyAccount.UserName, " 密码:", hyAccount.UserPass, "  还没登录信息,需要运行另一个任务取得登录信息" }));
                    base.HySeleniumMgr.GetPhoneSms = (string phone, string quHao) => {
                        string      str;
                        MobileModel mobe = mobileMgr.GetMobilenum(hyAccount.Phone);
                        if ((mobe == null ? false : !mobe.PhoneNumber.IsNullOrWhiteSpace()))
                        {
                            string sms = MobileMgr.GetYzm(mobileMgr.getVcodeAndHoldMobilenum(mobe), 6);
                            if (sms.IsNullOrWhiteSpace())
                            {
                                mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                            }
                            str = sms;
                        }
                        else
                        {
                            if ((mobe != null ? true : (mobe.Ex1.IsNullOrWhiteSpace() ? false : mobe.Ex1.IndexOf("没有可用号码") != -1)))
                            {
                                hyAccount.PhoneEx1 = mobe.Ex1;
                                hyAccount.Save();
                            }
                            str = null;
                        }
                        return(str);
                    };
                    try
                    {
                        int i = 0;
                        while (i < 5)
                        {
                            Thread.Sleep(5000);
                            base.HySeleniumMgr.WanShangZhiLiao(base.HySeleniumMgr.WebDriver);
                            if (!base.HySeleniumMgr.HasLogin(base.HySeleniumMgr.WebDriver))
                            {
                                base.HySeleniumMgr.LoginHy(hyAccount.UserName, hyAccount.UserPass, base.HySeleniumMgr.WebDriver);
                                i++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        XTrace.WriteLine(string.Concat("执行登录出错 ", exception.ToString()));
                    }
                    base.ZHInitCaoZuo();
                    if (XmlConfig <SeleniumConfig> .Current.ZhuCeInRoom)
                    {
                        base.ZhuCeLoginAfter();
                    }
                    base.GetCookiesAndSaveToDb(hyAccount);
                    flag = ret;
                }
                else
                {
                    Thread.Sleep(900);
                    mobileMgr.GetMobilenum(mobilenum.PhoneNumber);
                    mobileMgr.addIgnoreList(mobilenum);
                    mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                    XTrace.WriteLine("注册失败");
                    mobileMgr.reslut(mobilenum.PhoneNumber, false);
                    string jqmStr1 = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());
                    XTrace.WriteLine(string.Concat("测试 获取到的机器码为 ", jqmStr1));
                    flag = false;
                }
            }
            else
            {
                mobileMgr.addIgnoreList(mobilenum);
                mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                XTrace.WriteLine("手机号码已经注册!~~");
                mobileMgr.reslut(mobilenum.PhoneNumber, false);
                flag = false;
            }
            return(flag);
        }
        // Token: 0x060000A0 RID: 160 RVA: 0x000061D0 File Offset: 0x000043D0
        private void Prepace(HyAccount account)
        {
            FiddlerProxyLogic.GetProxy(null);
            bool flag = !account.JiQiMa.IsNullOrWhiteSpace();

            if (flag)
            {
                JiQiMa jqm = new JiQiMa();
                jqm.SetVal4ComOldJson(account.JiQiMa);
                HookMgr.jiQiMa = jqm;
            }
            string zh   = account.UserName;
            string mima = account.UserPass;

            Console.Title = string.Concat(new string[]
            {
                "当前账号 [",
                zh,
                "] [",
                mima,
                "] ",
                Console.Title
            });
            base.HySeleniumMgr             = new HySeleniumMgr();
            base.HySeleniumMgr.GetPhoneSms = delegate(string phone, string quHao)
            {
                bool   phoneSmsShouDong = XmlConfig <SeleniumConfig> .Current.PhoneSmsShouDong;
                string result;
                if (phoneSmsShouDong)
                {
                    string sm = DataFile.WtingRead("请输入手机号 [" + phone + "]的验证码", "你输入的手机号 [{phone}]的验证码是", delegate(string s)
                    {
                        bool flag7 = s.Length == 6;
                        return(!flag7);
                    });
                    result = sm;
                }
                else
                {
                    MobileType  ptType    = MobileTypeTool.Ex2ToMobileType(account.PhoneEx2);
                    MobileMgr   MobileMgr = new MobileMgr(ptType);
                    MobileModel mobe      = MobileMgr.GetMobilenum(account.Phone);
                    bool        flag4     = mobe == null || mobe.PhoneNumber.IsNullOrWhiteSpace();
                    if (flag4)
                    {
                        bool flag5 = mobe != null || (!mobe.Ex1.IsNullOrWhiteSpace() && mobe.Ex1.IndexOf("没有可用号码") != -1);
                        if (flag5)
                        {
                            account.PhoneEx1 = mobe.Ex1;
                            account.Save();
                        }
                        result = null;
                    }
                    else
                    {
                        string smsBody = MobileMgr.getVcodeAndHoldMobilenum(mobe);
                        string sms     = MobileMgr.GetYzm(smsBody, 6);
                        bool   flag6   = sms.IsNullOrWhiteSpace();
                        if (flag6)
                        {
                            MobileMgr.cancelSMSRecv(mobe.PhoneNumber);
                        }
                        result = sms;
                    }
                }
                return(result);
            };
            bool flag2;

            if (XmlConfig <SeleniumConfig> .Current.UpCookie && !account.WebCookie.IsNullOrWhiteSpace())
            {
                string webCookie = account.WebCookie;
                flag2 = (webCookie == null || webCookie.IndexOf("udb_biztoken") != -1);
            }
            else
            {
                flag2 = false;
            }
            bool flag3 = flag2;

            if (flag3)
            {
                XTrace.WriteLine("修改cookie 为: " + account.WebCookie);
                HookMgr.curCookie = account.WebCookie;
                HookMgr.UpCookie  = XmlConfig <SeleniumConfig> .Current.UpCookie;
                try
                {
                    IWebDriver webDriver = base.HySeleniumMgr.OpenFirst(zh, XmlConfig <SeleniumConfig> .Current.FirstUrl, "127.0.0.1:8877");
                    SelementHelper.AddCookies(webDriver, account.WebCookie);
                    Thread.Sleep(500);
                }
                catch (Exception ex)
                {
                    XTrace.WriteLine("修改cookie失败 " + ex.ToString());
                    Thread.Sleep(10000);
                    return;
                }
                finally
                {
                    base.Close();
                    HookMgr.curCookie = null;
                    HookMgr.UpCookie  = false;
                }
            }
            try
            {
                IWebDriver webDriver2 = base.HySeleniumMgr.OpenFirst(zh, XmlConfig <SeleniumConfig> .Current.FirstUrl, "127.0.0.1:8877");
                base.HySeleniumMgr.LoginHy(zh, mima, webDriver2);
            }
            catch (Exception ex2)
            {
                XTrace.WriteLine("登录虎牙账号出错 " + ex2.ToString());
            }
        }