Ejemplo n.º 1
0
        // 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());
            }
        }
Ejemplo n.º 2
0
 public static void AddCookies(IWebDriver webDriver, string Coookie)
 {
     SelementHelper.AddCookies(webDriver, HttpHelper.StrCookieToCookieCollection(Coookie));
 }