private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            try
            {
                if (webBrowser1.DocumentTitle.Trim().Contains("XE"))
                {
                    string html = webBrowser1.DocumentText;

                    ktf.Kuto Scrapper = new Kuto(html);

                    string val = Scrapper.Extract("<span class='uccResultAmount'>", "</span>").ToString();


                    this.Value = double.Parse(val.Replace(",", "").Replace(" ", "").Trim());
                    if (onConvertSuccess != null)
                    {
                        onConvertSuccess.Invoke(this, null);
                    }
                }
                else
                {
                    if (onConvertFail != null)
                    {
                        onConvertFail.Invoke(new Exception("Connection Error"), null);
                    }
                }
            }
            catch (Exception Err)
            {
                if (onConvertFail != null)
                {
                    onConvertFail.Invoke(Err, null);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Scraps the specified condition.
        /// </summary>
        /// <param name="Condition">The condition.</param>
        /// <param name="ColumnRules">The column rules.</param>
        /// <returns>List&lt;List&lt;ExtractDoc&gt;&gt;.</returns>
        public List <List <Kuto> > Scrap(string Condition, List <ScrapRule> ColumnRules)
        {
            List <List <Kuto> > rows = new List <List <Kuto> >();
            Kuto tmpDoc = new Kuto(this.ToString());

            while (tmpDoc.Contains(Condition))
            {
                rows.Add(tmpDoc.Scrap(ColumnRules));
                tmpDoc = tmpDoc.Extract(Condition, "");
            }


            return(rows);
        }
Beispiel #3
0
        /// <summary>
        /// Scraps the specified column rules.
        /// </summary>
        /// <param name="ColumnRules">The column rules.</param>
        /// <param name="Reduce">if set to <c>true</c> [reduce].</param>
        /// <returns>List&lt;ExtractDoc&gt;.</returns>
        public List <Kuto> Scrap(List <ScrapRule> ColumnRules, bool Reduce = false)
        {
            List <Kuto> ret    = new List <Kuto>();
            Kuto        tmpDoc = new Kuto(this.ToString());

            foreach (ScrapRule Rule in ColumnRules)
            {
                ret.Add(tmpDoc.Extract(Rule.startString, Rule.endString));
                if (Reduce)
                {
                    tmpDoc = tmpDoc.Extract(Rule.endString, "");
                }
            }
            return(ret);
        }