x86.frmMain.click_home C# (CSharp) Method

click_home() private method

private click_home ( System.Windows.Forms.WebBrowser web ) : void
web System.Windows.Forms.WebBrowser
return void
        private void click_home(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");
                    for (int index = 0; index < document.Links.Count; ++index)
                    {
                        string outerHtml = document.Links[index].OuterHtml;
                        string innerText = document.Links[index].InnerText;
                        if (innerText != null && innerText.IndexOf("进入店铺") != -1)
                        {
                            document.Links[index].SetAttribute("target", "_self");
                            document.Links[index].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.homeTime1 == this._curTask.homeTime2)
                            {
                                now = DateTime.Now;
                                this.lastCheckClick = now.AddSeconds((double)this._curTask.homeTime1);
                                this._curTask.jdTime1 = this._curTask.homeTime1;
                                break;
                            }
                            Random random = new Random();
                            Thread.Sleep(1000);
                            this._curTask.jdTime1 = random.Next(this._curTask.homeTime1, this._curTask.homeTime2);
                            now = DateTime.Now;
                            this.lastCheckClick = now.AddSeconds((double)this._curTask.jdTime1);
                            break;
                        }
                    }
                }
            }
            catch
            {
                this._curTask.Stu = "";
                this._curTask.optStu = 0;
            }
        }
frmMain