x86.frmMain.click_bb C# (CSharp) Méthode

click_bb() private méthode

private click_bb ( System.Windows.Forms.WebBrowser web ) : void
web System.Windows.Forms.WebBrowser
Résultat void
        private void click_bb(WebBrowser web)
        {
            try
            {
                HtmlDocument document = web.Document;
                Encoding encoding = Encoding.GetEncoding("gb2312");
                string documentText = web.DocumentText;
                if (documentText != null && documentText.Trim() != "")
                {
                    byte[] numArray = new byte[web.DocumentStream.Length];
                    web.DocumentStream.Read(numArray, 0, (int)web.DocumentStream.Length);
                    char[] chars = new char[encoding.GetCharCount(numArray, 0, numArray.Length)];
                    encoding.GetChars(numArray, 0, numArray.Length, chars, 0);
                    string str1 = new string(chars);
                    web.Document.GetElementsByTagName("a");
                    Random random1 = new Random();
                    Thread.Sleep(500);
                    int num1 = random1.Next(1, 10);
                    int num2 = 0;
                    web.Url.ToString().Trim().Replace("&", "&");
                    for (int index1 = 0; index1 < document.Links.Count; ++index1)
                    {
                        string outerHtml = document.Links[index1].OuterHtml;
                        if (outerHtml != null && (outerHtml.IndexOf("http://item.taobao.com/item.htm") != -1 || outerHtml.IndexOf("http://detail.tmall.com/item.htm") != -1) && outerHtml.IndexOf("catid=0") == -1)
                        {
                            if (this._clickedUrl.Trim() != "")
                            {
                                string[] strArray = sys.rValue(outerHtml, "id=", "&");
                                if (strArray.Length == 0)
                                    strArray = sys.rValue(outerHtml, "id=", "\"");
                                string str2 = "";
                                if (strArray.Length > 0)
                                {
                                    for (int index2 = 0; index2 < strArray[index2].Length; ++index2)
                                    {
                                        if (strArray[index2].Length > 5)
                                        {
                                            str2 = strArray[index2].Trim();
                                            break;
                                        }
                                    }
                                }
                                if (this._clickedUrl.IndexOf(str2) != -1)
                                    continue;
                            }
                            ++num2;
                            int index3 = index1;
                            if (num2 == num1)
                            {
                                document.Links[index1].SetAttribute("target", "_self");
                                document.Links[index1].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate, (object)this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                            if (index1 >= document.Links.Count - 3 && index3 >= 0)
                            {
                                document.Links[index3].SetAttribute("target", "_self");
                                document.Links[index3].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate,this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                        }
                        if (outerHtml != null && outerHtml.IndexOf("http://item.jd.com") != -1 && outerHtml.IndexOf("catid=0") == -1)
                        {
                            if (this._clickedUrl.Trim() != "")
                            {
                                string[] strArray = sys.rValue(outerHtml, "com/", ".html");
                                if (strArray.Length == 0)
                                    strArray = sys.rValue(outerHtml, "/", "\"");
                                string str2 = "";
                                if (strArray.Length > 0)
                                {
                                    for (int index2 = 0; index2 < strArray[index2].Length; ++index2)
                                    {
                                        if (strArray[index2].Length > 5)
                                        {
                                            str2 = strArray[index2].Trim();
                                            break;
                                        }
                                    }
                                }
                                if (this._clickedUrl.IndexOf(str2) != -1)
                                    continue;
                            }
                            ++num2;
                            int index3 = index1;
                            if (num2 == num1)
                            {
                                document.Links[index1].SetAttribute("target", "_self");
                                document.Links[index1].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate, (object)this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                            if (index1 >= document.Links.Count - 3 && index3 >= 0)
                            {
                                document.Links[index3].SetAttribute("target", "_self");
                                document.Links[index3].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate, (object)this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                        }
                        if (outerHtml != null && outerHtml.IndexOf("http://detail.1688.com") != -1 && outerHtml.IndexOf("catid=0") == -1)
                        {
                            if (this._clickedUrl.Trim() != "")
                            {
                                string[] strArray = sys.rValue(outerHtml, "offer/", ".html");
                                if (strArray.Length == 0)
                                    strArray = sys.rValue(outerHtml, "/", "\"");
                                string str2 = "";
                                if (strArray.Length > 0)
                                {
                                    for (int index2 = 0; index2 < strArray[index2].Length; ++index2)
                                    {
                                        if (strArray[index2].Length > 5)
                                        {
                                            str2 = strArray[index2].Trim();
                                            break;
                                        }
                                    }
                                }
                                if (this._clickedUrl.IndexOf(str2) != -1)
                                    continue;
                            }
                            ++num2;
                            int index3 = index1;
                            if (num2 == num1)
                            {
                                document.Links[index1].SetAttribute("target", "_self");
                                document.Links[index1].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate, (object)this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                            if (index1 >= document.Links.Count - 3 && index3 >= 0)
                            {
                                document.Links[index3].SetAttribute("target", "_self");
                                document.Links[index3].InvokeMember("Click");
                                this._curTask.Stu = "浏览宝贝";
                                string format = "{0} 正在浏览店内宝贝.";
                                DateTime now = DateTime.Now;
                                string str2 = now.ToString();
                                this.strLog = string.Format(format, (object)str2);
                                // ISSUE: method pointer
                                this.BeginInvoke(showdelegate, (object)this.strLog);
                                this._curTask.jd = this._curTask.jd + 1;
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                TaskTBSturct local = this._curTask;
                                now = DateTime.Now;
                                string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
                                // ISSUE: explicit reference operation
                                (local).startTime = str3;
                                if (this._curTask.dnTime1 == this._curTask.dnTime2)
                                {
                                    now = DateTime.Now;
                                    this.lastCheckClick = now.AddSeconds((double)this._curTask.dnTime2);
                                    this._curTask.jdTime1 = this._curTask.dnTime2;
                                    return;
                                }
                                Random random2 = new Random();
                                Thread.Sleep(1000);
                                this._curTask.jdTime1 = random2.Next(this._curTask.dnTime1, this._curTask.dnTime2);
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                                return;
                            }
                        }
                    }
                    this._curTask.Stu = "浏览主页";
                    this._curTask.homeTime1 = 80;
                    this._curTask.homeTime2 = 120;
                    // ISSUE: method pointer
                    this.BeginInvoke(clickdelegateClick_home, (object)this.webBrowser1);
                }
            }
            catch
            {
                this._curTask.Stu = "";
                this._curTask.optStu = 0;
            }
        }
        private void add(int flag)
frmMain