예제 #1
0
 public void setWindowFront()
 {
     try
     {
         while (true)
         {
             TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
             base.Activate();
             Thread.Sleep(300);
         }
     }
     catch
     {
     }
 }
예제 #2
0
        public void sendMsgToMainFormAndExit(string string_4, int msgtyp)
        {
            IntPtr intPtr;

            try
            {
                int num = 0;
                while (true)
                {
                    IntPtr intPtr1 = TaobaoLoginForm.FindWindow(null, this.mainFormTitle);
                    intPtr = intPtr1;
                    if (!(intPtr1 == IntPtr.Zero) || num > 40)
                    {
                        break;
                    }
                    num++;
                    Thread.Sleep(100);
                }
                if (intPtr == IntPtr.Zero)
                {
                    Environment.Exit(0);
                }
                UnicodeEncoding unicodeEncoding = new UnicodeEncoding();
                char[]          chars           = unicodeEncoding.GetChars(unicodeEncoding.GetBytes(string_4));
                for (int i = 0; i < (int)chars.Length; i++)
                {
                    char chr = chars[i];
                    TaobaoLoginForm.SendMessage(intPtr, 1125, chr, 0);
                }
                TaobaoLoginForm.SendMessage(intPtr, 1125, 0, msgtyp);
                Environment.Exit(0);
            }
            catch (Exception exception)
            {
                this.method_9(string.Concat("[sendMessgeToMainForm]出错!", 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()));
                }
            }
        }
예제 #4
0
 private void timer_0_Tick_1(object sender, EventArgs e)
 {
     try
     {
         this.timer_0.Stop();
         HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("TPL_username_1");
         if (!(!(elementById != null) || this.username.Equals("") ? true : this.password.Equals("")))
         {
             base.Visible     = true;
             base.WindowState = FormWindowState.Normal;
             base.Activate();
             IntPtr intPtr = TaobaoLoginForm.FindWindow(null, this.Text);
             TaobaoLoginForm.SetForegroundWindow(intPtr);
             HtmlElement htmlElement = this.webBrowserLoginAlimama.Document.GetElementById("TPL_username_1");
             Point       offset      = this.GetOffset(htmlElement);
             Point       point       = this.method_4(this.webBrowserLoginAlimama);
             this.int_1 = point.X + offset.X + 100;
             this.int_2 = point.Y + offset.Y + 35;
             MockInput.click(intPtr, this.int_1, this.int_2);
             elementById.InvokeMember("click");
             elementById.SetAttribute("value", this.username);
             Thread.Sleep(400);
             SendKeys.Send("{TAB}");
             this.timer_0 = new System.Windows.Forms.Timer()
             {
                 Interval = 1500
             };
             this.timer_0.Tick += new EventHandler(this.timer_0_Tick_2);
             this.timer_0.Start();
         }
         else if (this.loginErrCnt < 5)
         {
             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_1);
             this.timer_0.Start();
         }
         else
         {
             this.cleanCookie();
             this.method_9("等待【登录页面打开】超过5次!");
             this.loginErrCnt = 0;
             this.webBrowserLoginAlimama.Navigate(this.string_2);
             this.timer_0 = new System.Windows.Forms.Timer()
             {
                 Interval = 3000
             };
             this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
             this.timer_0.Start();
         }
     }
     catch (Exception exception2)
     {
         Exception exception = exception2;
         try
         {
             this.cleanCookie();
             this.method_9(string.Concat("[inputAlimamaUserName]出错,等待3秒重试!", exception.ToString()));
             this.webBrowserLoginAlimama.Navigate(this.string_2);
             this.timer_0 = new System.Windows.Forms.Timer()
             {
                 Interval = 3000
             };
             this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
             this.timer_0.Start();
         }
         catch (Exception exception1)
         {
             this.method_9(string.Concat("[inputAlimamaUserName]出错!ex1:", exception1.ToString()));
         }
     }
 }