Пример #1
0
        //获取【说说】的好友信息
        private void button7_Click(object sender, EventArgs e)
        {
            string info = null;

            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);
                mshtml.IHTMLElementCollection divs = (mshtml.IHTMLElementCollection)frame.all.tags("div");
                IEnumerator div = divs.GetEnumerator();
                while (div.MoveNext())
                {
                    mshtml.IHTMLElement item = (mshtml.IHTMLElement)div.Current;

                    if (item.className == "ui_avatar" || item.className == "feed_like")
                    {
                        mshtml.IHTMLElementCollection childrenCol = (mshtml.IHTMLElementCollection)item.children;
                        IEnumerator cusers = childrenCol.GetEnumerator();
                        while (cusers.MoveNext())
                        {
                            mshtml.IHTMLElement celement = (mshtml.IHTMLElement)cusers.Current;
                            if (celement.tagName == "a" || celement.tagName == "A")
                            {
                                string href = (string)celement.getAttribute("href", 0);
                                if (href != null && href.Contains("http:"))
                                {
                                    info += href + "\n";
                                }
                            }
                        }
                    }
                }
            }
            MessageBox.Show(info);
        }
Пример #2
0
        private void PraiseFriendFix()
        {
            try
            {
                mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

                for (int i = 0; i < htmlDoc.frames.length; ++i)
                {
                    object index = i;
                    mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                    IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                    mshtml.IHTMLElementCollection tagls = (mshtml.IHTMLElementCollection)frame.all.tags("A");
                    IEnumerator tagie = tagls.GetEnumerator();
                    while (tagie.MoveNext())
                    {
                        mshtml.IHTMLElement element = (mshtml.IHTMLElement)tagie.Current;
                        if (element.className == "qz_like_btn c_tx mr8")
                        {
                            string style = (string)element.style.cssText;

                            if (element.innerText != null && element.innerText.Contains("取消赞") && style != "display: none;")
                            {
                                element.click();
                                success.Add(curQQ);

                                richTextBox1.Text = richTextBox1.Text + "【成功】" + curQQ + "\n";
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception) { }

            failed.Add(curQQ);
            richTextBox1.Text = richTextBox1.Text + "【失败】" + curQQ + "\n";
        }
Пример #3
0
        //3.提交
        private mshtml.IHTMLElement commentStep3(mshtml.IHTMLElement commentTag)
        {
            if (commentTag == null)
            {
                return(null);
            }
            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;
            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                mshtml.IHTMLElementCollection tagls = (mshtml.IHTMLElementCollection)frame.all.tags("a");
                IEnumerator tagie = tagls.GetEnumerator();
                while (tagie.MoveNext())
                {
                    try
                    {
                        mshtml.IHTMLElement element = (mshtml.IHTMLElement)tagie.Current;
                        if (element.className == "btn-post gb_bt  evt_click" &&
                            element.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement == commentTag)
                        {
                            element.click();
                            return(commentTag);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("*********************************************************");
                        Console.WriteLine(ex.ToString());
                        Console.WriteLine("*********************************************************");
                    }
                }
            }
            return(null);
        }
Пример #4
0
        //2.编辑
        private bool commentStep2(mshtml.IHTMLElement commentTag)
        {
            if (commentTag == null)
            {
                return(false);
            }
            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;
            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                mshtml.IHTMLElementCollection tagls = (mshtml.IHTMLElementCollection)frame.all.tags("div");
                IEnumerator tagie = tagls.GetEnumerator();
                while (tagie.MoveNext())
                {
                    mshtml.IHTMLElement element = (mshtml.IHTMLElement)tagie.Current;
                    if (commentTag == element && element.className == "mod-comments")
                    {
                        mshtml.IHTMLElementCollection childrenCol = (mshtml.IHTMLElementCollection)element.all;
                        IEnumerator cusers = childrenCol.GetEnumerator();
                        while (cusers.MoveNext())
                        {
                            mshtml.IHTMLElement element2 = (mshtml.IHTMLElement)cusers.Current;
                            if (element2.className == "textinput textarea c_tx2" || element2.className == "textinput textarea c_tx2 input_focus textinput_focus")
                            //if (element2.className == "textinput textarea c_tx2 input_focus textinput_focus")
                            {
                                element2.innerText = getReplyStr();
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Пример #5
0
        //获取最后活跃时间
        private void getLasTime()
        {
            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                for (int j = 0; j < frame.frames.length; ++j)
                {
                    object rj = j;
                    mshtml.IHTMLWindow2 frameWindow2 = frame.frames.item(ref rj) as mshtml.IHTMLWindow2;

                    IHTMLDocument2 frame2 = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow2);
                    mshtml.IHTMLElementCollection userlist = (mshtml.IHTMLElementCollection)frame2.all.tags("span");
                    IEnumerator users = userlist.GetEnumerator();
                    while (users.MoveNext())
                    {
                        mshtml.IHTMLElement element = (mshtml.IHTMLElement)users.Current;
                        string str = element.innerText;
                        if (str != null && str.Contains("月") && str.Contains("日") && str.Contains(":"))
                        {
                            DateTime dnow = DateTime.Now;
                            str = str.Replace("月", "-");
                            str = str.Replace("日", "-");
                            str = str.Replace(" ", "");
                            str = str.Replace(":", "-");
                            str = String.Format("{0}-{1}-00", dnow.Year, str);
                            spider.UIDB.logintime = str;
                            return;
                        }
                    }
                }
            }
        }
Пример #6
0
        //输入账号密码
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;
                object index = 0;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                mshtml.IHTMLElementCollection logins = (mshtml.IHTMLElementCollection)frame.all.tags("input");

                mshtml.IHTMLInputElement element = (mshtml.IHTMLInputElement)logins.item("u", 0);
                element.value = "305723370";

                element       = (mshtml.IHTMLInputElement)logins.item("p", 0);
                element.value = "cdtanji51520";
            }
            catch (System.Exception _e)
            {
                Console.Write(_e.Message);
            }
        }
Пример #7
0
        //1.打开编辑框
        private bool commentStep1(mshtml.IHTMLElement commentTag)
        {
            if (hascommentOpened(commentTag))
            {
                return(true);
            }
            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;
            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                mshtml.IHTMLElementCollection tagls = (mshtml.IHTMLElementCollection)frame.all.tags("div");
                IEnumerator tagie = tagls.GetEnumerator();
                while (tagie.MoveNext())
                {
                    mshtml.IHTMLElement element = (mshtml.IHTMLElement)tagie.Current;
                    if (commentTag == element && element.className == "mod-comments")
                    {
                        mshtml.IHTMLElementCollection childrenCol = (mshtml.IHTMLElementCollection)element.all;
                        IEnumerator cusers = childrenCol.GetEnumerator();
                        while (cusers.MoveNext())
                        {
                            mshtml.IHTMLElement element1 = (mshtml.IHTMLElement)cusers.Current;
                            if (element1.className == "mod-commnets-poster feedClickCmd comment_default_inputentry")
                            {
                                element1.click();
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Пример #8
0
        private void PraiseFriend()
        {
            try
            {
                mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

                for (int i = 0; i < htmlDoc.frames.length; ++i)
                {
                    object index = i;
                    mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                    IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                    mshtml.IHTMLElementCollection tagls = (mshtml.IHTMLElementCollection)frame.all.tags("A");
                    IEnumerator tagie = tagls.GetEnumerator();
                    while (tagie.MoveNext())
                    {
                        mshtml.IHTMLElement element = (mshtml.IHTMLElement)tagie.Current;
                        if (element.className == "qz_like_btn c_tx mr8")
                        {
                            if (element.innerText != null && !element.innerText.Contains("取消赞"))
                            {
                                element.click();
                                pro = "点赞完成";
                                //richTextBox1.Text = richTextBox1.Text + "【成功】" + curQQ + "\n";
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception) { }

            //richTextBox1.Text = richTextBox1.Text + "【失败】" + curQQ + "\n";
            Zhan();//失败后直接进入下一个
        }
Пример #9
0
 public TabPageWithWebBrowser(mshtml.IHTMLWindow2 opener)
     : this(opener, false)
 {
 }
Пример #10
0
        public override void Tick()
        {
            if (Enable)
            {
                try
                {
                    //性别和年龄
                    mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;
                    for (int i = 0; i < htmlDoc.frames.length; ++i)
                    {
                        object index = i;
                        mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                        IHTMLDocument2      frame    = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);
                        mshtml.IHTMLElement sex      = (mshtml.IHTMLElement)frame.all.item("sex", 0);
                        mshtml.IHTMLElement age      = (mshtml.IHTMLElement)frame.all.item("age", 0);
                        mshtml.IHTMLElement birthday = (mshtml.IHTMLElement)frame.all.item("birthday", 0);

                        if (sex != null)
                        {
                            spider.UIDB.sex = sex.outerText;
                        }
                        if (age != null)
                        {
                            spider.UIDB.age = Convert.ToInt32(age.outerText);
                        }
                        if (birthday != null)
                        {
                            spider.UIDB.birthday = birthday.outerText;
                        }
                    }

                    //说说、日志、照片
                    for (int i = 0; i < webBrowser1.Document.Window.Frames.Count; ++i)
                    {
                        HtmlDocument frame = webBrowser1.Document.Window.Frames[i].Document;
                        HtmlElement  blog  = frame.GetElementById("profile-blog-cnt");
                        HtmlElement  photo = frame.GetElementById("profile-photo-cnt");
                        HtmlElement  mood  = frame.GetElementById("profile-mood-cnt");

                        if (blog != null)
                        {
                            spider.UIDB.blog = Convert.ToInt32(blog.OuterText);
                        }
                        if (photo != null)
                        {
                            spider.UIDB.photo = Convert.ToInt32(photo.OuterText);
                        }
                        if (mood != null)
                        {
                            spider.UIDB.mood = Convert.ToInt32(mood.OuterText);
                        }
                    }

                    ++spider.okcount;

                    //获取动态QQ好友信息
                    getFriend();
                    getNickName();
                    getLasTime();
                    spider.UIDB.zone_authority = 1;
                    spider.UIDB.used           = 1;

                    ChangeCommon("ShuoShuo");
                    ////ChangeCommon("NewUser");
                }
                catch (Exception e)
                {
                    Log(e.Message);
                    ChangeCommon("NewUser");
                }
            }
        }
Пример #11
0
        //获取聊天内容(未完)
        private void button13_Click(object sender, EventArgs e)
        {
            string info = null;

            mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

            for (int i = 0; i < htmlDoc.frames.length; ++i)
            {
                object index = i;
                mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);

                for (int j = 0; j < frame.frames.length; ++j)
                {
                    object rj = j;
                    mshtml.IHTMLWindow2 frameWindow2 = frame.frames.item(ref rj) as mshtml.IHTMLWindow2;

                    IHTMLDocument2 frame2 = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow2);

                    mshtml.IHTMLElement host_home_feeds = (mshtml.IHTMLElement)frame2.all.item("host_home_feeds", 0);
                    if (host_home_feeds != null)
                    {
                        mshtml.IHTMLElementCollection children = (mshtml.IHTMLElementCollection)host_home_feeds.children;
                        IEnumerator child = children.GetEnumerator();
                        while (child.MoveNext())//li
                        {
                            mshtml.IHTMLElement element = (mshtml.IHTMLElement)child.Current;
                            if (element.className == "f-single f-s-s")
                            {
                                mshtml.IHTMLElementCollection children2 = (mshtml.IHTMLElementCollection)element.children;
                                IEnumerator child2 = children2.GetEnumerator();
                                while (child2.MoveNext())
                                {
                                    mshtml.IHTMLElement element2 = (mshtml.IHTMLElement)child2.Current;
                                    if (element2.className == "f-wrap")
                                    {
                                        //太长了,未完
                                    }
                                }
                            }
                        }
                    }


                    //mshtml.IHTMLElementCollection userlist = (mshtml.IHTMLElementCollection)frame2.all.tags("div");
                    //IEnumerator users = userlist.GetEnumerator();
                    //while (users.MoveNext())
                    //{
                    //    mshtml.IHTMLElement element = (mshtml.IHTMLElement)users.Current;
                    //    if (element.className != null)
                    //        Console.WriteLine(element.className);

                    //    if (element.className == "comments-content" && element.innerText != null)
                    //    {
                    //        info += element.innerText + "|";
                    //        break;
                    //    }

                    //}
                }
            }
            MessageBox.Show(info);
        }
        private void CrawlCurrentPage(WebBrowser wb, bool isOffline, bool IsUnConfirmChecked, ref bool hasValidData)
        {
            mshtml.IHTMLDocument2 doc2 = isOffline ? null : (mshtml.IHTMLDocument2)wb.Document;
            string html = isOffline ? s_htmlFake : doc2.body.innerHTML;


            Debug.WriteLine(html);


            List <ImportInvoiceDTO>      list         = new List <ImportInvoiceDTO>();
            List <hParser.Tags.TableRow> validRowList = new List <hParser.Tags.TableRow>();

            //this.parseResult = "";

            #region  使用IHTMLDocument2提取HTML

            mshtml.HTMLTableClass table = IsUnConfirmChecked ? (mshtml.HTMLTableClass)doc2.all.item("example1", 0) : (mshtml.HTMLTableClass)doc2.all.item("example", 0);
            if (table == null)
            {
                hasValidData = false;
                //throw new InvalidOperationException("无效table");
                return;
            }
            mshtml.HTMLTableSectionClass tbody = (mshtml.HTMLTableSectionClass)table.lastChild;
            if (tbody == null)
            {
                hasValidData = false;
                //throw new InvalidOperationException("无效tbody");
                return;
            }

            var tbodyHtml = tbody.innerHTML;

            if (0 == string.Compare(tbody.innerText, "没找到记录", StringComparison.InvariantCultureIgnoreCase))
            {
                hasValidData = false;
                //throw new InvalidOperationException("无效tbody");
                return;
            }
            #region WPF WebBroswer交互源代码DOM元素总结

#if RESEARCH
            //HTMLDocument doc01 = wb.Document as HTMLDocument;
            ////IHTMLDocument2 doc02 = wb.Document as IHTMLDocument2;
            //Debug.WriteLine(doc01.body.innerHTML);


            ///读/写元素
            ///
            mshtml.IHTMLElement login_pass = (mshtml.IHTMLElement)doc2.all.item("login_pass", 0);
            mshtml.IHTMLElement password   = (mshtml.IHTMLElement)doc2.all.item("password", 0);
            password.setAttribute("value", "12345678");
            login_pass.setAttribute("style", "");

            mshtml.IHTMLElement login_pass1 = (mshtml.IHTMLElement)doc2.all.item("login_pass1", 0);
            mshtml.IHTMLElement password1   = (mshtml.IHTMLElement)doc2.all.item("password1", 0);
            login_pass1.setAttribute("style", "display:none;");
            //password1.setAttribute("style", "width:1px");

            //IHTMLElement item = doc01.getElementById("ptmm");
            //item.innerHTML = "<INPUT id=\"pwd\" class=\"login_input password\" type=\"text\" value=\"\" />";

            ////  doc01.body.insertAdjacentHTML(,);
            //MessageBox.Show(item.innerText);

            //wb.NavigateToString(doc01.body.innerHTML);

            /// Trigger event
            //点击确定按钮
            loginBT.click();


            /// script injection
            ///
            //Basic ds = new Basic();
            //wb.ObjectForScripting = ds;//该对象可由显示在WebBrowser控件中的网页所包含的脚本代码访问

            ///Levarage JS
            ///
            mshtml.IHTMLWindow2 win = (mshtml.IHTMLWindow2)doc2.parentWindow;
            win.execScript("Login('12345678', '', 1)", "javascript");
            return;
#endif


            #endregion

            #endregion
            #region 使用HtmlParser提取tbodyHtml
            Lexer              lexer    = new Lexer(tbodyHtml);
            hParser.Parser     parser   = new hParser.Parser(lexer);
            hParser.NodeFilter filter   = new NodeClassFilter(typeof(Winista.Text.HtmlParser.Tags.TableRow));
            NodeList           nodeList = parser.Parse(filter);
            if (nodeList.Count == 0)
            {
                hasValidData = false;
                MessageBox.Show("没有符合要求的节点");
            }
            else
            {
                for (int i = 0; i < nodeList.Count; i++)
                {
                    //抓取一行
                    var tagTR = parserTR(nodeList[i]);

                    #region 充填有效行
                    if (tagTR != null)
                    {
                        validRowList.Add(tagTR);
                    }
                    #endregion
                }

                parserValidTR(validRowList, IsUnConfirmChecked, ref list);
            }

            #endregion
            #region 使用HtmlParser提取HTML

            /* Lexer lexer = new Lexer(html);
             * hParser.Parser parser = new hParser.Parser(lexer);
             * hParser.NodeFilter filter = new NodeClassFilter(typeof(Winista.Text.HtmlParser.Tags.TableRow));
             * NodeList nodeList = parser.Parse(filter);
             * if (nodeList.Count == 0)
             *  MessageBox.Show("没有符合要求的节点");
             * else
             * {
             *  for (int i = 0; i < nodeList.Count; i++)
             *  {
             *      //抓取一行
             *      var tagTR = parserTR(nodeList[i]);
             *
             #region 充填有效行
             *      if (tagTR != null)
             *          validRowList.Add(tagTR);
             #endregion
             *
             *  }
             *
             *  parserValidTR(validRowList, ref list);
             *
             * }
             */
            #endregion

            #region 日志 & 导出 & 持久化

            if (list == null || list.Count == 0)
            {
                MessageBox.Show("该页面上没有检测到预期数据");
                hasValidData = false;
            }

            ImportInvoiceListDTO soap = new ImportInvoiceListDTO
            {
                List   = list,
                Result = new ImportInvoiceResultDTO
                {
                    Message = "CALLBACK",
                    Status  = 9
                }
            };

            Debug.Write(soap);
            #region Log
            if (this.IfLog == "1")
            {
                soap.List.ForEach(impinfo =>
                {
                    if (IsUnConfirmChecked)
                    {
                        LogHelper.WriteLog(typeof(WebBoxView), string.Format("发票代码{0} 发票号码{1} 开票日期{2} 销方税号{3} 金额{4} 税额{5} 来源{6} 发票状态{7} 勾选标志{8} 操作时间{9}", impinfo.InvoiceCode, impinfo.InvoiceNumber, impinfo.CreateDate, impinfo.SalesTaxNumber, impinfo.Amount, impinfo.Tax, impinfo.From, impinfo.Status, impinfo.SelectTag, impinfo.ChosenTime));
                    }
                    else
                    {
                        LogHelper.WriteLog(typeof(WebBoxView), string.Format("发票代码{0} 发票号码{1} 开票日期{2} 销方税号{3} 金额{4} 税额{5} 来源{6} 发票状态{7} 确认月份{8}", impinfo.InvoiceCode, impinfo.InvoiceNumber, impinfo.CreateDate, impinfo.SalesTaxNumber, impinfo.Amount, impinfo.Tax, impinfo.From, impinfo.Status, impinfo.SelectTag));
                    }
                });
            }
            #endregion
            if (this.IfCallWS == "1")
            {
                CallWS(soap);
            }
            Debug.Write("本页已同步完成,请点击下一页继续同步");
            //FakeBusy();

            #endregion
        }
        public void LoadCompletedHandler(NavigationEventArgs e, object view, WebBrowser wb)
        {
            var currentUrl = wb.Source.AbsoluteUri;

            if (wb == null)
            {
                return;
            }
            wb.Visibility = Visibility.Visible;

            var vw = view as WebBoxView;

            if (vw != null)
            {
                ProgressBar pBar = vw.FindName("ProgBar") as ProgressBar;
                if (pBar != null)
                {
                    pBar.Visibility = Visibility.Hidden;
                }
            }

            this.IsBusy = false;
            if (currentUrl.Contains("#"))
            {
                currentUrl = currentUrl.Replace("#", "");
            }
            if (currentUrl == this.TargetUri)
            {
                this.TipInfo = "加载已完成";
                //MessageBox.Show("请先查询所需的进向数据");
                // StartCrawl();
            }
            else if (currentUrl != this.StartUri)
            {//除首页登录页面外,都重定向到fpcx.html
                wb.Source = new Uri(this.TargetUri);
            }

            bool isOffline = string.Compare(this.IsOffline, "1", StringComparison.InvariantCultureIgnoreCase) == 0 ? true : false;

            mshtml.IHTMLDocument2 doc2 = isOffline ? null : (mshtml.IHTMLDocument2)wb.Document;
            string html = isOffline ? s_htmlFake : doc2.body.innerHTML;

            #region 加迷彩   login_header  login_footer
            mshtml.IHTMLElement login_header = (mshtml.IHTMLElement)doc2.all.item("login_header", 0);
            mshtml.IHTMLElement login_footer = (mshtml.IHTMLElement)doc2.all.item("login_footer", 0);
            mshtml.IHTMLElement footer       = (mshtml.IHTMLElement)doc2.all.item("footer", 0);
            mshtml.IHTMLElement header       = (mshtml.IHTMLElement)doc2.all.item("header", 0);

            if (login_header != null)
            {
                // login_header.setAttribute("style", "display: none;");
                login_header.innerHTML = "";
            }
            if (login_footer != null)
            {
                // login_header.setAttribute("style", "display: none;");
                login_footer.innerHTML = "";
            }
            if (footer != null)
            {
                // login_header.setAttribute("style", "display: none;");
                footer.innerHTML = "";
            }
            if (header != null)
            {
                // login_header.setAttribute("style", "display: none;");
                header.innerHTML = "";
            }
            //屏蔽右键
            //(wb.Document as mshtml.HTMLDocumentEvents_Event).oncontextmenu += new mshtml.HTMLDocumentEvents_oncontextmenuEventHandler(ExtendFrameControl_oncontextmenu);
            //wb.ContextMenu = null;
            //wb.ContextMenuOpening += Wb_ContextMenuOpening;

            #endregion

            #region Auto Login



            if (currentUrl == this.StartUri && !string.IsNullOrEmpty(this.DeviceKey))
            {
                mshtml.IHTMLWindow2 win = (mshtml.IHTMLWindow2)doc2.parentWindow;
                win.execScript("Login('12345678', '', 1)", "javascript");
                return;
            }

            #endregion


            // ShowScreen("", typeof(StartScreenViewModel));
        }
Пример #14
0
 private string[] GetRFFYDInfo()
 {
     string[] strArray = new string[3];
     try
     {
         HTMLDocument document = (HTMLDocument)this.axWebBrowser1.Document;
         if (!document.url.ToLower().Contains("default.aspx"))
         {
             return(null);
         }
         FramesCollection frames = document.parentWindow.frames;
         for (int i = 0; i < frames.length; i++)
         {
             object pvarIndex             = i;
             mshtml.IHTMLWindow2 window2  = (mshtml.IHTMLWindow2)frames.item(ref pvarIndex);
             FramesCollection    framess2 = window2.frames;
             string tagName = "";
             for (int j = 0; j < framess2.length; j++)
             {
                 object obj3 = j;
                 mshtml.IHTMLWindow2 window3   = (mshtml.IHTMLWindow2)framess2.item(ref obj3);
                 HTMLDocument        document2 = window3.document as HTMLDocument;
                 if (document2.url.Contains("InDoor.aspx"))
                 {
                     HTMLTextAreaElement element = document2.getElementById("txtCPH") as HTMLTextAreaElement;
                     HTMLTable           table   = document2.getElementById("GridView1") as HTMLTable;
                     bool flag = false;
                     foreach (HTMLTableRow row in table.rows)
                     {
                         foreach (HTMLTableCell cell in row.cells)
                         {
                             foreach (mshtml.IHTMLElement element2 in cell.getElementsByTagName("INPUT"))
                             {
                                 if ((element2.getAttribute("type", 0).ToString() == "checkbox") && (element2.getAttribute("checked", 0).ToString().ToUpper() == "TRUE"))
                                 {
                                     tagName = cell.tagName;
                                     flag    = true;
                                 }
                             }
                             if (flag)
                             {
                                 if (cell.cellIndex == 3)
                                 {
                                     strArray[0] = cell.innerText;
                                 }
                                 if (cell.cellIndex == 1)
                                 {
                                     strArray[1] = cell.innerText;
                                 }
                                 if (cell.cellIndex == 4)
                                 {
                                     strArray[2] = cell.innerText;
                                 }
                             }
                         }
                         if (flag)
                         {
                             break;
                         }
                     }
                 }
             }
         }
         return(strArray);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Пример #15
0
        public override void Tick()
        {
            if (Enable)
            {
                try
                {
                    string info = null;
                    mshtml.HTMLDocumentClass htmlDoc = webBrowser1.Document.DomDocument as mshtml.HTMLDocumentClass;

                    for (int i = 0; i < htmlDoc.frames.length; ++i)
                    {
                        object index = i;
                        mshtml.IHTMLWindow2 frameWindow = htmlDoc.frames.item(ref index) as mshtml.IHTMLWindow2;

                        IHTMLDocument2 frame = CodecentrixSample.CrossFrameIE.GetDocumentFromWindow(frameWindow);
                        mshtml.IHTMLElementCollection divs = (mshtml.IHTMLElementCollection)frame.all.tags("div");
                        IEnumerator div = divs.GetEnumerator();
                        while (div.MoveNext())
                        {
                            mshtml.IHTMLElement item = (mshtml.IHTMLElement)div.Current;

                            if (item.className == "ui_avatar" || item.className == "feed_like")
                            {
                                mshtml.IHTMLElementCollection childrenCol = (mshtml.IHTMLElementCollection)item.children;
                                IEnumerator cusers = childrenCol.GetEnumerator();
                                while (cusers.MoveNext())
                                {
                                    mshtml.IHTMLElement celement = (mshtml.IHTMLElement)cusers.Current;
                                    if (celement.tagName == "a" || celement.tagName == "A")
                                    {
                                        string href = (string)celement.getAttribute("href", 0);
                                        if (href != null && href.Contains("http:"))
                                        {
                                            info += href + "\n";
                                            spider.AddQQ(href);
                                        }
                                    }
                                }
                            }
                        }
                    }


                    //string info = "";
                    //for (int i = 0; i < webBrowser1.Document.Window.Frames.Count; ++i)
                    //{
                    //    HtmlDocument frame = webBrowser1.Document.Window.Frames[i].Document;
                    //    HtmlElementCollection divs = frame.GetElementsByTagName("div");
                    //    for (int j = 0; j < divs.Count; ++j)
                    //    {
                    //        string className = divs[j].GetAttribute("className");
                    //        if (className == "ui_avatar")
                    //        {
                    //            HtmlElementCollection a = divs[j].GetElementsByTagName("a");
                    //            if (a != null && a.Count > 0)
                    //            {
                    //                string url = a[0].GetAttribute("href");
                    //                info += url + "\n";
                    //                spider.AddQQ(url);
                    //            }
                    //        }
                    //        else if (className == "feed_like")
                    //        {
                    //            HtmlElementCollection a = divs[j].GetElementsByTagName("a");
                    //            if (a != null && a.Count > 0)
                    //            {
                    //                for (int k = 0; k < a.Count; ++k)
                    //                {
                    //                    if (a[k].GetAttribute("className") == "c_tx")
                    //                    {
                    //                        string url = a[0].GetAttribute("href");
                    //                        info += url + "\n";
                    //                        spider.AddQQ(url);
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //}

                    spider.UserGetOver();
                    Log(info);
                    ChangeCommon("NewUser");
                }
                catch (Exception e)
                {
                    Log(e.Message);
                    ChangeCommon("NewUser");
                }
            }
        }