Exemple #1
0
        public double GetCurrMoney(GeckoDocument doc)
        {
            string outval = "";
            bool   succ   = WebRule.existElement(doc, GobalSetting.AmountId, out outval);

            if (succ)
            {
                double outRes = 0.00;
                if (double.TryParse(outval, out outRes))
                {
                    return(outRes);
                }
                return(0);
            }
            return(0);

            GeckoElement ElPoint = doc?.GetElementById(GobalSetting.AmountId);
            double       ret     = 0;

            if (ElPoint != null)
            {
                double.TryParse(ElPoint?.TextContent, out ret);
            }
            return(ret);
        }
Exemple #2
0
        private void DocumentCompleted(object sender, GeckoDocumentCompletedEventArgs e)
        {
            GeckoDocument test = geckoWebBrowser.Document;

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(test.Body.InnerHtml);
            bool update = false;

            foreach (var node in doc.DocumentNode.Descendants("div").Where(x => x.Attributes["class"] != null && x.Attributes["class"].Value.ToLower().Contains("release-links")))
            {
                foreach (Anime anime in animes)
                {
                    if (node.Attributes["class"].Value.ToString().ToLower().Contains(anime.classname().ToLower()))
                    {
                        var links = node.Descendants("a").Where(x => x.Attributes["href"] != null && x.Attributes["href"].Value.ToString().Contains("uploaded"));
                        if (links.Count() > 0)
                        {
                            Clipboard.SetText(links.First().Attributes["href"].Value.ToString());
                            anime.episode++;
                            update = true;
                            // i don't care about UI I just want it to wait for an arbitrary amount of time so JDownloader can react
                            Thread.Sleep(2500);
                        }
                    }
                }
            }
            if (update)
            {
                saveAnime();
            }
        }
Exemple #3
0
        GeckoElement FindTagContainingText(GeckoDocument doc, string text)
        {
            string[] tagtypes =
            {
                "h1",
                "h2",
                "h3",
                "h4",
                "h5",
                "h6",
                "a",
                "div",
                "p",
                "span",
            };

            foreach (string tagtype in tagtypes)
            {
                foreach (GeckoElement elem in doc.GetElementsByTagName(tagtype))
                {
                    if (elem.InnerHtml.Trim() == text.Trim())
                    {
                        return(elem);
                    }
                }
            }

            return(null);
        }
Exemple #4
0
 private bool Sending(GeckoDocument document, Uri uri)
 {
     //https://www.esmplus.com/Escrow/Delivery/SendingExcel?
     //siteGbn =1&searchAccount=10757^isorikids^1&searchDateType=ODD&searchSDT=2017-10-06&searchEDT=2017-11-06&searchKey=ON&searchKeyword=&searchStatus=0&searchAllYn=N&searchType=0&searchDistrType=AL
     logger.Info("4-3.정산예정금 - ( 주문관리 > 배송중/배송완료 )");
     try
     {
         DateTime enddate   = DateTime.Now;
         DateTime startdate = enddate.AddMonths(-1);
         this.buffer.Append("https://www.esmplus.com/Escrow/Delivery/SendingExcel?");
         this.buffer.Append(CreateGetParameter(new Dictionary <String, String>()
         {
             { "siteGbn", "1" },
             { "searchAccount", idkey },
             { "searchDateType", "ODD" },
             { "searchSDT", startdate.ToString("yyyy-MM-dd") },
             { "searchEDT", enddate.ToString("yyyy-MM-dd") },
             { "searchKey", "ON" },
             { "searchKeyword", "" },
             { "searchStatus", "0" },
             { "searchAllYn", "N" },
             { "searchType", "0" },
             { "searchDistrType", "AL" }
         }));
         PostAjaxJson(document, this.buffer.ToString(), new Dictionary <String, Object>()
         {
             { "eSortType", "" },
         });
     }
     finally
     {
         this.buffer.Clear();
     }
     return(true);
 }
        public static ScrapTable SelectTableByClass(this GeckoDocument document, String classname, int index = 0)
        {
            ScrapTable   ret        = new ScrapTable();
            GeckoElement element    = document.GetElementsByClassName(classname)[index] as GeckoElement;
            var          collection = element.GetElementsByTagName("TR");

            foreach (var row in collection)
            {
                foreach (var col in row.ChildNodes)
                {
                    if (!(col is GeckoHtmlElement))
                    {
                        continue;
                    }
                    var buffer = col as GeckoHtmlElement;
                    if ("TD".Equals(buffer.TagName) || "TH".Equals(buffer.TagName))
                    {
                        //ret.Set(col.TextContent);
                        //ret.Set((col as GeckoHtmlElement).OuterHtml);
                        ret.Set(col as GeckoHtmlElement);
                    }
                }
                ret.Next();
            }
            return(ret);
        }
Exemple #6
0
 protected void PostAjaxJson(GeckoDocument document, string ajaxurl, IDictionary <String, Object> param)
 {
     try
     {
         this.buffer.Append("<HTML>");
         this.buffer.Append("<BODY>");
         this.buffer.Append("<FORM ACTION='").Append(ajaxurl).Append("' method='POST'>");
         foreach (String key in param.Keys)
         {
             this.buffer.Append("<INPUT type='hidden' name='")
             .Append(key)
             .Append("' id='")
             .Append(key)
             .Append("' value='")
             .Append(param[key])
             .Append("'>");
         }
         this.buffer.Append("<INPUT type='submit' id='trigger'>");
         this.buffer.Append("</FORM>");
         this.buffer.Append("</BODY>");
         this.buffer.Append("</HTML>");
         if (browser.Document != document)
         {
             logger.Debug("Browser!!!!!!!!!");
             document = browser.Document;
         }
         document.Body.InnerHtml = this.buffer.ToString();
         document.GetElementById <GeckoInputElement>("trigger").Click();
     }
     finally
     {
         this.buffer.Clear();
     }
 }
Exemple #7
0
        private bool LacSettleDetail(GeckoDocument document, Uri uri)
        {
            logger.Info("3-1.정산내역 ( 정산관리 > 정산내역 조회 > 옥션 정산내역 관리 )");
            DateTime enddate     = DateTime.Now;
            DateTime startdate   = enddate.AddYears(-1).AddDays(1);
            var      SearchParam = new
            {
                MemberID        = Parameter.Id,
                ItemNo          = "",
                BuyerName       = "",
                BuyerId         = "",
                OrderNo         = 0,
                DateType        = "R",
                DateFrom        = startdate.ToString("yyyy-MM-dd"),
                DateTo          = enddate.ToString("yyyy-MM-dd"),
                CategoryId      = "",
                RemittanceType  = "0",
                GroupOrderSeqNo = "0",
                PageNo          = 1,
                PageSize        = 20
            };
            String json = JsonConvert.SerializeObject(SearchParam);

            logger.Debug(json);
            PostAjaxJson(document, "https://www.esmplus.com/Member/Settle/IacRemitListExcelDownload?SearchParam=" + json, new Dictionary <String, Object>()
            {
                { "eSortType", "" },
            });
            return(true);
        }
        private void PrivateNavigate(GeckoDocument document, String url)
        {
            var aa = document.GetElementsByClassName("naver");

            document.GetElementByClassName <GeckoAnchorElement>("naver").Href = url;
            document.GetElementByClassName <GeckoAnchorElement>("naver").Click();
        }
Exemple #9
0
        private bool ItemsMng(GeckoDocument document, Uri uri)
        {
            /*document.GetElementByName<GeckoInputElement>("chkStatus", 1).Checked = true;
             * document.GetElementByName<GeckoInputElement>("chkSiteId", 1).Checked = true;
             * document.GetElementByName<GeckoInputElement>("chkSiteA", 0).Checked = true;
             * document.GetElementById<GeckoImageElement>("imgItemsSearch").Click();*/
            this.buffer.Append("http://www.esmplus.com/Sell/Items/GetItemMngList");

            var SearchParam = new
            {
                Keyword              = "",
                SiteId               = "1",
                SellType             = 0,
                CategoryCode         = "",
                CustCategoryCode     = 0,
                TransPolicyNo        = 0,
                StatusCode           = "11",
                SearchDateType       = 0,
                StartDate            = "",
                EndDate              = "",
                SellerId             = "",
                StockQty             = -1,
                SellPeriod           = 0,
                DeliveryFeeApplyType = 0,
                OptAddDeliveryType   = 0,
                SellMinPrice         = 0,
                SellMaxPrice         = 0,
                OptSelUseIs          = -1,
                PremiumEnd           = 0,
                PremiumPlusEnd       = 0,
                FocusEnd             = 0,
                FocusPlusEnd         = 0,
                CatalogGroup         = 0,
                GoodsIds             = "",
                SellMngCode          = "",
                OrderByType          = 11,
                NotiItemReg          = -1,
                UserEvaluate         = "",
                SearchClause         = "",
                ScoreRange           = 0,
                ShopCateReg          = -1,
                IsTPLUse             = "",
                GoodsName            = "",
                SdBrandId            = 0,
                SdBrandName          = ""
            };
            String json = JsonConvert.SerializeObject(SearchParam);

            logger.Debug(this.buffer.ToString());
            PostAjaxJson(document, this.buffer.ToString(), new Dictionary <String, Object>()
            {
                { "paramsData", json },
                { "page", "1" },
                { "start", "0" },
                { "limit", "500" },
                { "group", "[{\"property\":\"GoodsMasterNo\",\"direction\":\"ASC\"}]" }
            });
            return(true);
        }
        public void Analyse(GeckoDocument document)
        {
            actions.Clear();

            AddVoiceActions(document, "button");
            AddVoiceActions(document, "a");
            AddVoiceActions(document, "iframe");
        }
        private Boolean SellerMenuAction(GeckoDocument document, Uri uri)
        {
            var data02 = document.GetElementById <GeckoElement>("sellerGradePop").ParentElement.GetElementByTagName <GeckoElement>("A").TextContent;

            SetCommonData(2, data02);
            base.Navigate("https://soffice.11st.co.kr/register/SellerInfoEdit.tmall?method=sellerInfoEdit&orgMenuNo=5002");
            return(true);
        }
Exemple #12
0
        protected void ExcuteJavascript(GeckoDocument document, String script)
        {
            GeckoElement scriptelement = document.CreateElement("script");

            scriptelement.SetAttribute("type", "text/javascript");
            scriptelement.TextContent = script;
            document.Head.AppendChild(scriptelement);
        }
        private Boolean SellerInfoEdit(GeckoDocument document, Uri uri)
        {
            FlowMap["register/SellerInfoEdit.tmall"] = SellerInfoEdit2;

            document.GetElementById <GeckoInputElement>("mem_pwd").Value = Parameter.Pw;
            document.GetElementByClassName <GeckoAnchorElement>("xladtype").Click();
            return(true);
        }
Exemple #14
0
        private Boolean CSManagement(GeckoDocument document, Uri uri)
        {
            var data = document.GetElementById <GeckoElement>("msg_auction").GetElementsByTagName("A")[0].FirstChild.NodeValue;

            SetCommonData(20, data);
            base.Navigate("http://www.esmplus.com/Home/SSO?code=TDM155&id=" + Parameter.Id);
            return(false);
        }
        /// <summary>
        /// 5-4. 정산예정금 ( 배송관리 →구매확정)
        /// </summary>
        /// <param name="document"></param>
        /// <param name="uri"></param>
        /// <returns></returns>
        private Boolean SellerRemittanceAction3(GeckoDocument document, Uri uri)
        {
            String json = document.Body.TextContent;
            SellerRemittanceActionJson obj = JsonConvert.DeserializeObject <SellerRemittanceActionJson>(json);
            var node = obj.list[0];

            SetPackageData(5, 0, JsonConvert.SerializeObject(node));
            return(false);
        }
Exemple #16
0
        public static Properties FindEntryProperties(string url, GeckoDocument document)
        {
            var xpComUri = IOService.CreateNsIUri(url);
            var ret      =
                _imgCache.Instance.FindEntryProperties(xpComUri, document._domDocument).Wrap((x) => new Properties(x));

            Xpcom.FreeComObject(ref xpComUri);
            return(ret);
        }
Exemple #17
0
        public void AddScriptContent(string content)
        {
            GeckoDocument      doc    = WebBrowser.Document;
            var                head   = doc.GetElementsByTagName("head").First();
            GeckoScriptElement script = doc.CreateElement("script") as GeckoScriptElement;

            script.Type = "text/javascript";
            script.Text = content;
            head.AppendChild(script);
        }
        private Boolean CSManagement(GeckoDocument document, Uri uri)
        {
            var data = document.GetElementById <GeckoElement>("msg_gmarket").GetElementsByTagName("A")[0].FirstChild.NodeValue;

            // 1. 긴급메시지 건수
            SetCommonData(20, data);
            //보류
            //base.Navigate();
            return(true);
        }
Exemple #19
0
        public string GetRequest(String url, GeckoDocument document, HttpMethod method, IDictionary <String, Object> param = null)
        {
            try
            {
                string paramStr = param != null?CombineParameter(param) : null;

                if (HttpMethod.GET.Equals(method) && paramStr != null)
                {
                    url += (url.IndexOf("?") != -1) ? "&" : "?" + paramStr;
                }
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method      = method.ToString();
                request.ContentType = "application/x-www-form-urlencoded";

                //cookie set??
                String cookie = browser.Document.Cookie;
                if (cookie != null && !String.IsNullOrEmpty(cookie))
                {
                    String[] buffer = cookie.Split(';');
                    request.CookieContainer = new CookieContainer();
                    foreach (var b in buffer)
                    {
                        String            temp = b.Trim();
                        int               pos  = temp.IndexOf("=");
                        System.Net.Cookie c    = new System.Net.Cookie();
                        c.Domain = browser.Document.Domain;
                        c.Name   = temp.Substring(0, pos);
                        c.Value  = temp.Substring(pos + 1);
                        request.CookieContainer.Add(c);
                    }
                }
                if (HttpMethod.POST.Equals(method) && paramStr != null)
                {
                    byte[] byteArray = Encoding.UTF8.GetBytes(paramStr);
                    request.ContentLength = byteArray.Length;
                    using (Stream dataStream = request.GetRequestStream())
                    {
                        dataStream.Write(byteArray, 0, byteArray.Length);
                    }
                }
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                    {
                        return(reader.ReadToEnd());
                    }
                }
            }
            catch (Exception e)
            {
                this.logger.Error(e.ToString());
                throw e;
            }
        }
        private Boolean StatsPeriodProdSel(GeckoDocument document, Uri uri)
        {
            String json = document.Body.TextContent;
            StatsPeriodProdSelJson obj = JsonConvert.DeserializeObject <StatsPeriodProdSelJson>(json);
            var node = obj.statsPeriodProdSelSummary[0];

            SetPackageData(0, index++, JsonConvert.SerializeObject(node));
            if (std.Year == DateTime.Now.Year && std.Month == DateTime.Now.Month)
            {
                std = DateTime.Now.AddYears(-3).AddDays(DateTime.Now.Day * -1).AddDays(1);
                DateTime etd1     = std.AddMonths(1).AddDays(-1);
                var      interval = DateTime.Now - std;
                index = 0;
                this.buffer.Clear();
                this.buffer.Append("http://soffice.11st.co.kr/remittance/SellerRemittanceAction.tmall?");
                this.buffer.Append(CreateGetParameter(new Dictionary <String, String>()
                {
                    { "method", "getSellerOwnSelStatSoffice" },
                    { "dtlSearchStlmntType", "N" },
                    { "searchDtType", "BUY_CNFRM_DT" },
                    { "stDate", std.ToString("yyyyMMdd") },
                    { "edDate", std.ToString("yyyyMMdd") },
                    { "dtlSearchType", "" },
                    { "ordPrdStat", "" },
                    { "intervalDay", interval.Days.ToString() },
                    { "dtlSearchVal", "" }
                }));
                base.Navigate(this.buffer.ToString());
                return(true);
            }
            std = std.AddMonths(1);
            DateTime etd = std.AddMonths(1).AddDays(-1);

            if (std.Year == DateTime.Now.Year && std.Month == DateTime.Now.Month)
            {
                etd = DateTime.Now;
            }
            this.buffer.Clear();
            this.buffer.Append("http://soffice.11st.co.kr/stats/StatsPeriodProdSel.tmall?");
            this.buffer.Append(CreateGetParameter(new Dictionary <String, String>()
            {
                { "method", "getStatsPeriodProdSelList" },
                { "start", "0" },
                { "limit", "10" },
                { "stDate", std.ToString("yyyy/MM/dd").Replace("-", "/") },
                { "edDate", etd.ToString("yyyy/MM/dd").Replace("-", "/") },
                { "stDatePre", std.ToString("yyyy/MM/dd").Replace("-", "/") },
                { "edDatePre", etd.ToString("yyyy/MM/dd").Replace("-", "/") },
                { "dtPeriod", "PRE_THREE_MONTH" },
                { "dispGb", "grid" }
            }));
            base.Navigate(this.buffer.ToString());
            return(true);
        }
        private Boolean Index(GeckoDocument document, Uri uri)
        {
            SetCommonData(0, "TRUE");
            var data26 = document.GetElementById <GeckoElement>("prdQnaAnswerCnt").FirstChild.NodeValue;

            SetCommonData(26, data26);
            var data25 = document.GetElementById <GeckoElement>("emergencyCnt").FirstChild.NodeValue;

            SetCommonData(25, data25);
            base.Navigate("http://soffice.11st.co.kr/marketing/SellerMenuAction.tmall?method=getSellerMainNew&usedClfCd=00&memSuplCmpClfCd=01");
            return(true);
        }
 private Boolean Login(GeckoDocument document, Uri uri)
 {
     if (uri.ToString().IndexOf("returnURL") != -1)
     {
         SetCommonData(0, "FALSE");
         return(false);
     }
     document.GetElementById <GeckoInputElement>("loginName").Value = Parameter.Id;
     document.GetElementById <GeckoInputElement>("passWord").Value  = Parameter.Pw;
     document.GetElementByClassName <GeckoInputElement>("btn_login").Click();
     return(true);
 }
Exemple #23
0
        private bool GetItemMngList(GeckoDocument document, Uri uri)
        {
            String data = document.Body.GetElementsByTagName("PRE")[0].FirstChild.NodeValue;
            //logger.Debug(data);
            GetItemMngListJson json = JsonConvert.DeserializeObject <GetItemMngListJson>(data);
            int index = 0;

            foreach (var item in json.Data)
            {
                SetPackageData(6, index++, JsonConvert.SerializeObject(item));
            }
            return(false);
        }
Exemple #24
0
        public bool IsLoadCompleted(GeckoDocument indoc)
        {
            string strNotice = GobalSetting.HostKey;

            return(WebRule.existElement(indoc, GobalSetting.HostKey));


            if (indoc.Head.OuterHtml.IndexOf(strNotice) > 0)
            {
                return(true);
            }
            return(false);
        }
Exemple #25
0
 private Boolean Login(GeckoDocument document, Uri uri)
 {
     if (uri.ToString().IndexOf("ReturnValue") != -1)
     {
         SetCommonData(0, "FALSE");
         return(false);
     }
     document.GetElementByName <GeckoInputElement>("rdoSiteSelect", 0).Checked = true;
     document.GetElementById <GeckoInputElement>("SiteId").Value       = Parameter.Id;
     document.GetElementById <GeckoInputElement>("SitePassword").Value = Parameter.Pw;
     document.GetElementById <GeckoAnchorElement>("btnSiteLogOn").Click();
     return(true);
 }
        /// <summary>
        /// 5-3. 정산예정금 (배송관리 →배송완료 )
        /// </summary>
        /// <param name="document"></param>
        /// <param name="uri"></param>
        /// <returns></returns>
        private Boolean OrderingLogisticsAction3(GeckoDocument document, Uri uri)
        {
            String json = document.Body.TextContent;
            OrderingLogisticsActionJson obj = JsonConvert.DeserializeObject <OrderingLogisticsActionJson>(json);

            index = 0;
            obj.orderingLogistics.ForEach(node =>
            {
                SetPackageData(4, index++, JsonConvert.SerializeObject(node));
            });
            FlowMap["remittance/SellerRemittanceAction.tmall"] = SellerRemittanceAction2;
            base.Navigate("http://soffice.11st.co.kr/remittance/SellerRemittanceAction.tmall?method=displaySellerOwnSelStatSoffice");
            return(true);
        }
Exemple #27
0
        /// <summary>
        /// add a jscript source file
        /// </summary>
        /// <param name="filename"></param>
        public void AddScriptSource(string filename)
        {
            if (!File.Exists(Path.Combine(Path.GetDirectoryName(_url), filename)))
            {
                throw new FileNotFoundException(filename);
            }

            GeckoDocument      doc    = WebBrowser.Document;
            var                head   = doc.GetElementsByTagName("head").First();
            GeckoScriptElement script = doc.CreateElement("script") as GeckoScriptElement;

            script.Type = "text/javascript";
            script.Src  = filename;
            head.AppendChild(script);
        }
        /// <summary>
        /// 5-2. 정산예정금 (배송관리-배송중)
        /// </summary>
        /// <param name="document"></param>
        /// <param name="uri"></param>
        /// <returns></returns>
        private Boolean OrderingLogisticsAction2(GeckoDocument document, Uri uri)
        {
            String json = document.Body.TextContent;
            OrderingLogisticsActionJson obj = JsonConvert.DeserializeObject <OrderingLogisticsActionJson>(json);

            index = 0;
            obj.orderingLogistics.ForEach(node =>
            {
                SetPackageData(3, index++, JsonConvert.SerializeObject(node));
            });
            FlowMap["escrow/OrderingLogisticsAction.tmall"] = OrderingLogisticsAction3;
            this.buffer.Clear();
            this.buffer.Append("https://soffice.11st.co.kr/escrow/OrderingLogisticsAction.tmall?");
            this.buffer.Append(CreateGetParameter(new Dictionary <String, String>()
            {
                { "method", "getOrderLogisticsList" },
                { "listType", "orderingLogistics" },
                { "start", "0" },
                { "limit", "10000" },
                { "shDateType", "02" },
                { "shDateFrom", DateTime.Now.AddYears(-1).ToString("yyyyMMdd") },
                { "shDateTo", DateTime.Now.ToString("yyyyMMdd") },
                { "shBuyerType", "" },
                { "shBuyerText", "" },
                { "shProductStat", "501" },
                { "shDelayReport", "" },
                { "shPurchaseConfirm", "" },
                { "shGblDlv", "N" },
                { "prdNo", "" },
                { "shStckNo", "" },
                { "shOrderType", "on" },
                { "addrSeq", "" },
                { "isAbrdSellerYn", "" },
                { "abrdOrdPrdStat", "" },
                { "isItalyAgencyYn", "" },
                { "shErrYN", "" },
                { "gblRcvrNm", "" },
                { "gblRcvrMailNo", "" },
                { "gblRcvrBaseAddr", "" },
                { "gblRcvrDtlsAddr", "" },
                { "gblRcvrTlphn", "" },
                { "gblRcvrPrtblNo", "" },
                { "shOrdLang", "" },
                { "shDlvClfCd", "" }
            }));
            base.Navigate(this.buffer.ToString());
            return(true);
        }
Exemple #29
0
        private Boolean Test(GeckoDocument document, Uri uri)
        {
            logger.Debug("DEBUG.......");
            ThreadPool.QueueUserWorkItem(c =>
            {
                for (int i = 0; i < 60; i++)
                {
                    Thread.Sleep(1000);
                    logger.Debug("Second " + (i + 1));
                }

                this.End();
                Scraper.Exit();
            });
            return(true);
        }
Exemple #30
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            GeckoDocument doc = _browser.WebBrowser.Document;

            var body             = doc.GetElementsByTagName("body").First();
            GeckoHtmlElement div = doc.CreateElement("div") as GeckoHtmlElement;

            div.Id = "output";
            body.AppendChild(div);

            _browser.RunJavaScript("gatherSettings()");

            FormData     = div.InnerHtml;
            DialogResult = DialogResult.OK;
            Close();
        }
Exemple #31
0
        GeckoElement FindTagContainingText(GeckoDocument doc, string text)
        {
            string[] tagtypes = {
                                    "h1",
                                    "h2",
                                    "h3",
                                    "h4",
                                    "h5",
                                    "h6",
                                    "a",
                                    "div",
                                    "p",
                                    "span",
                                };

            foreach (string tagtype in tagtypes)
            {
                foreach (GeckoElement elem in doc.GetElementsByTagName(tagtype))
                {
                    if (elem.InnerHtml.Trim() == text.Trim())
                    {
                        return elem;
                    }
                }
            }

            return null;
        }
Exemple #32
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementAcceptPlay(GeckoDocument document)
 {
     //logout.php
     GeckoElementCollection nodes = document.GetElementsByTagName("button");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String name = ((GeckoHtmlElement)node).GetAttribute("name");
         if (name == "__CONFIRM__")
         {
             return ((GeckoHtmlElement)node);
         }
     }
     return null;
 }
Exemple #33
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementCode(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("input");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String name = ((GeckoHtmlElement)node).GetAttribute("name");
         if (name != null && name.Contains("code")) return (GeckoHtmlElement)node;
         String style = ((GeckoHtmlElement)node).GetAttribute("style");
         if (style != null && style.Contains("-wap-input-format")) return (GeckoHtmlElement)node;
     }
     return null;
 }
Exemple #34
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementHelp(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("a");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String href = ((GeckoHtmlElement)node).GetAttribute("href");
         if (href != null && (href.Contains("/help/212848065405122") || href.Contains("/help/174987089221178")))
         {
             return (GeckoHtmlElement)node;
         }
     }
     return null;
 }
Exemple #35
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementInput(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("input");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String type = node.GetAttribute("type");
         if (type != "hidden") return (GeckoHtmlElement) node;
     }
     return null;
 }
Exemple #36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementLogout(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("a");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String href = ((GeckoHtmlElement)node).GetAttribute("href");
         if (href != null && href.Contains("logout.php"))
         {
             String logoutHtml = ((GeckoHtmlElement)node).InnerHtml;
             if (logoutHtml.StartsWith("Logout") || logoutHtml.StartsWith("Đăng xuất") || logoutHtml.StartsWith("Log out") || logoutHtml.StartsWith("Log Out"))
             {
                 return (GeckoHtmlElement)node;
             }
             else
             {
                 return null;
             }
         }
     }
     return null;
 }
 private void UnloadDocument()
 {
     //if (_Document != null)
     //{
     //      FromDOMDocumentTable.Remove((nsIDOMDocument)_Document.DomObject);
     //}
     _Document = null;
 }
        public void ShowPageProperties(GeckoDocument document)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            new PropertiesDialog((nsIDOMHTMLDocument)document.DomObject).ShowDialog(this);
        }
Exemple #39
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementNextWizard(GeckoDocument document)
 {
     //NEXT
     GeckoElementCollection nodes = document.GetElementsByTagName("a");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         if (node.TextContent == "Tiếp" || node.TextContent == "Next")
         {
             return ((GeckoHtmlElement)node);
         }
     }
     //SAVE SETTINGS
     nodes = document.GetElementsByTagName("input");
     foreach (GeckoElement node in nodes)
     {
         String type = ((GeckoHtmlElement)node).GetAttribute("type");
         if (type != null && type.ToUpper() == "SUBMIT")
         {
             String value = ((GeckoHtmlElement)node).GetAttribute("value");
             if (value != null && (value.ToUpper() == "LƯU CÀI ĐẶT" || value.ToUpper() == "SAVE SETTINGS"))
             {
                 return ((GeckoHtmlElement)node);
             }
             String name = ((GeckoHtmlElement)node).GetAttribute("name");
             if (name != null && (name == "submit[Continue]"))
             {
                 return ((GeckoHtmlElement)node);
             }
         }
     }
     return null;
 }
Exemple #40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementSendConfirmCode(GeckoDocument document)
 {
     GeckoHtmlElement sendConfirmCode = (GeckoInputElement)document.GetElementsByClassName("w x y z ba").FirstOrDefault();
     if (sendConfirmCode != null && (sendConfirmCode.GetAttribute("value") == "Send Confirmation Code" || sendConfirmCode.GetAttribute("value") == "Gửi mã xác nhận"))
     {
         return sendConfirmCode;
     }
     return null;
 }
Exemple #41
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementSubmit(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("input");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String type = ((GeckoHtmlElement)node).GetAttribute("type");
         if (type != null && type.ToUpper() == "SUBMIT")
         {
             String value = ((GeckoHtmlElement)node).GetAttribute("value");
             if (value != null && (value.ToUpper() == "CONTINUE" || value.ToUpper() == "SUBMIT" || value.ToUpper() == "CONFIRM" || value.ToUpper() == "CHẤP NHẬN" || value.ToUpper() == "GỬI" || value.ToUpper() == "TIẾP TỤC"))
             {
                 return (GeckoHtmlElement)node;
             }
         }
     }
     return null;
 }
Exemple #42
0
 /// <summary>
 /// <input type="hidden" value="1585885549" name="to" autocomplete="off">
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementTo(GeckoDocument document)
 {
     GeckoHtmlElement to = document.GetElementsByName("to").FirstOrDefault();
     if (to.GetAttribute("type") == "hidden") return to;
     return null;
 }
Exemple #43
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 private GeckoHtmlElement getGeckoHtmlElementInvalid(GeckoDocument document)
 {
     GeckoElementCollection nodes = document.GetElementsByTagName("span");
     if (nodes == null) return null;
     foreach (GeckoElement node in nodes)
     {
         String html = ((GeckoHtmlElement)node).InnerHtml;
         if (html != null && (html.Contains("bạn đã có tài khoản") || html.Contains("Không thể xác thực") || html.Contains("lòng thử lại số khác") || html.Contains("try a different number") || html.Contains("sử dụng một địa chỉ email hoặc số di động") || html.Contains("already in use by a registered account") || html.Contains("Could not validate your mobile number")))
         {
             return (GeckoHtmlElement)node;
         }
     }
     return null;
 }
Exemple #44
0
        private GeckoHtmlElement GetElementByXpath(GeckoDocument doc, string xpath)
        {
            if (doc == null) return null;

            xpath = xpath.Replace("/html/", "");
            GeckoElementCollection eleColec = doc.GetElementsByTagName("html"); if (eleColec.Length == 0) return null;
            GeckoHtmlElement ele = eleColec[0];
            string[] tagList = xpath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string tag in tagList)
            {
                System.Text.RegularExpressions.Match mat = System.Text.RegularExpressions.Regex.Match(tag, "(?<tag>.+)\\[@id='(?<id>.+)'\\]");
                if (mat.Success == true)
                {
                    string id = mat.Groups["id"].Value;
                    GeckoHtmlElement tmpEle = doc.GetHtmlElementById(id);
                    if (tmpEle != null) ele = tmpEle;
                    else
                    {
                        ele = null;
                        break;
                    }
                }
                else
                {
                    mat = System.Text.RegularExpressions.Regex.Match(tag, "(?<tag>.+)\\[(?<ind>[0-9]+)\\]");
                    if (mat.Success == false)
                    {
                        GeckoHtmlElement tmpEle = null;
                        foreach (GeckoNode it in ele.ChildNodes)
                        {
                            if (it.NodeName.ToLower() == tag)
                            {
                                tmpEle = (GeckoHtmlElement)it;
                                break;
                            }
                        }
                        if (tmpEle != null) ele = tmpEle;
                        else
                        {
                            ele = null;
                            break;
                        }
                    }
                    else
                    {
                        string tagName = mat.Groups["tag"].Value;
                        int ind = int.Parse(mat.Groups["ind"].Value);
                        int count = 0;
                        GeckoHtmlElement tmpEle = null;
                        foreach (GeckoNode it in ele.ChildNodes)
                        {
                            if (it.NodeName.ToLower() == tagName)
                            {
                                count++;
                                if (ind == count)
                                {
                                    tmpEle = (GeckoHtmlElement)it;
                                    break;
                                }
                            }
                        }
                        if (tmpEle != null) ele = tmpEle;
                        else
                        {
                            ele = null;
                            break;
                        }
                    }
                }
            }

            return ele;
        }
Exemple #45
0
        protected void UpdateUrlAbsolute(GeckoDocument doc, GeckoHtmlElement ele)
        {
            string link = doc.Url.GetLeftPart(UriPartial.Authority);

            var eleColec = ele.GetElementsByTagName("IMG");
            foreach (GeckoHtmlElement it in eleColec)
            {
                if (!it.GetAttribute("src").StartsWith("http://"))
                    it.SetAttribute("src", link + it.GetAttribute("src"));
            }
            eleColec = ele.GetElementsByTagName("A");
            foreach (GeckoHtmlElement it in eleColec)
            {
                if (!it.GetAttribute("href").StartsWith("http://"))
                    it.SetAttribute("href", link + it.GetAttribute("href"));
            }
        }