示例#1
0
 private void TaobaoLoginForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         base.Visible = true;
         string cookieString = GetCookie.GetCookieString("http://www.taobao.com");
         if (!TaobaoSvc.checkTaobaoLogin(cookieString))
         {
             this.sendMsgToMainFormAndExit("close", CUtil.FORM_MSG_TYPE_CLOSENOTLOGINED);
         }
         else
         {
             this.sendMsgToMainFormAndExit(cookieString, CUtil.FORM_MSG_TYPE_LOGINED);
         }
     }
     catch (Exception exception)
     {
         this.method_9(string.Concat("[FormClosingProcess]出错,", exception.ToString()));
     }
 }
示例#2
0
 public void checkManualLogin()
 {
     try
     {
         while (true)
         {
             string cookieString = GetCookie.GetCookieString("http://www.taobao.com");
             if (!TaobaoSvc.checkTaobaoLogin(cookieString))
             {
                 Thread.Sleep(2000);
             }
             else
             {
                 base.Visible = true;
                 this.sendMsgToMainFormAndExit(cookieString, CUtil.FORM_MSG_TYPE_LOGINED);
             }
         }
     }
     catch (Exception exception)
     {
         this.method_9(string.Concat("[checkManualLogin]出错!", exception.ToString()));
     }
 }
示例#3
0
        private void timer_0_Tick_4(object sender, EventArgs e)
        {
            Point  offset;
            Thread thread;

            try
            {
                this.timer_0.Stop();
                if (TaobaoSvc.checkTaobaoLogin(GetCookie.GetCookieString("http://www.taobao.com")))
                {
                    this.method_9("淘宝登录成功!");
                    this.logined = true;
                    try
                    {
                        this.timer_0.Stop();
                    }
                    catch
                    {
                    }
                }
                else if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请输入验证码"))
                {
                    if ((this.string_0.Equals("") ? true : this.string_1.Equals("")))
                    {
                        this.method_9("出现验证码,没有设置UU打码打码账号和密码,请手动输入!");
                    }
                    else
                    {
                        this.method_9("出现验证码,开始打码!");
                        this.timer_0 = new System.Windows.Forms.Timer()
                        {
                            Interval = 500
                        };
                        this.timer_0.Tick += new EventHandler(this.timer_0_Tick_5);
                        this.timer_0.Start();
                    }
                }
                else if (!(!this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请点击图中的") ? true : !this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证通过")))
                {
                    this.method_9("点图中文字,验证通过!");
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 100
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
                    this.timer_0.Start();
                }
                else if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请点击图中的"))
                {
                    this.method_9("点图中文字,软件没有办法自动点,请手动点击文字!");
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 10000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
                    this.timer_0.Start();
                }
                else if (!(!this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") ? true : !this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证通过")))
                {
                    this.method_9("拖动验证通过!");
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 100
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
                    this.timer_0.Start();
                }
                else if (!(!this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") ? true : !this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请按住滑块,拖动到最右边")))
                {
                    base.Visible     = true;
                    base.WindowState = FormWindowState.Normal;
                    base.Activate();
                    TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
                    this.method_9("开始拖动滑块。。。。。请等待!");
                    Point       point       = this.method_4(this.webBrowserLoginAlimama);
                    HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("_n1z");
                    if (elementById == null)
                    {
                        this.method_9("新拖动模式,阿里妈妈又疯了!");
                        elementById = this.webBrowserLoginAlimama.Document.GetElementById("nc_1_n1z");
                        offset      = this.GetOffset(elementById);
                        offset.X    = offset.X + 10;
                        offset.Y    = offset.Y + 45;
                        this.int_1  = offset.X + point.X;
                        this.int_2  = offset.Y + point.Y;
                        thread      = new Thread(new ParameterizedThreadStart(this.method_5));
                        thread.Start(string.Concat(270, ""));
                    }
                    else
                    {
                        this.method_9("旧拖动模式,软件能搞的定!");
                        offset     = this.GetOffset(elementById);
                        offset.X   = offset.X + 10;
                        offset.Y   = offset.Y + 45;
                        this.int_1 = offset.X + point.X;
                        this.int_2 = offset.Y + point.Y;
                        thread     = new Thread(new ParameterizedThreadStart(this.method_5));
                        thread.Start(string.Concat(220, ""));
                    }
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 3000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
                    this.timer_0.Start();
                }
                else if (!(!this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") ? true : !this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("加载中")))
                {
                    base.Visible     = true;
                    base.WindowState = FormWindowState.Normal;
                    base.Activate();
                    TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
                    this.method_9("需要拖动滑块,加载滑块中,请等待!");
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 1000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
                    this.timer_0.Start();
                }
                else if (!(!this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") ? true : !this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("网络不给力")))
                {
                    this.method_9("拖动滑块验证失败,重新登录!");
                    this.webBrowserLoginAlimama.Navigate(this.string_2);
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 2000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
                    this.timer_0.Start();
                }
                else if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证码错误,请重新输入"))
                {
                    this.method_9("验证码错误,请重新输入!");
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 500
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_5);
                    this.timer_0.Start();
                }
                else if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("账户名和密码不匹配"))
                {
                    this.method_9("你输入的账户名和密码不匹配,请手动输入!");
                }
                else if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("网站无法显示该页面"))
                {
                    this.method_9("网站无法显示该页面,登录程序重新启动!");
                    this.cleanCookie();
                    this.sendMsgToMainFormAndExit("restart", CUtil.FORM_MSG_TYPE_NOTOPEN);
                }
                else if (this.loginErrCnt < 8)
                {
                    TaobaoLoginForm taobaoLoginForm = this;
                    taobaoLoginForm.loginErrCnt = taobaoLoginForm.loginErrCnt + 1;
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 1000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
                    this.timer_0.Start();
                }
                else
                {
                    this.method_9("等待检查登录超过8次!");
                    this.loginErrCnt = 0;
                    this.sendMsgToMainFormAndExit("restart", CUtil.FORM_MSG_TYPE_CHKTMOUT);
                }
            }
            catch (Exception exception2)
            {
                Exception exception = exception2;
                try
                {
                    this.method_9(string.Concat("[checkLoginSuccess]出错!", exception.ToString()));
                    this.webBrowserLoginAlimama.Navigate(this.string_2);
                    this.timer_0 = new System.Windows.Forms.Timer()
                    {
                        Interval = 2000
                    };
                    this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
                    this.timer_0.Start();
                }
                catch (Exception exception1)
                {
                    this.method_9(string.Concat("[checkLoginSuccess]出错!ex1:", exception1.ToString()));
                }
            }
        }