Esempio n. 1
0
        public decimal WebSelectByCssSelector(Provider Provider)
        {
            IFfeWebParser webParser = null;

            switch (WebParser)
            {
            case Parser.Auto:
                webParser = FfeWebController.AutoWebParserSelection(Provider.Url, cssSelector: Provider.CssSelector, regExPattern: Provider.RegExPattern);
                break;

            case Parser.HAP:
                webParser = new FfeWebHap(Provider.Url);
                break;

            case Parser.AngleSharp:
                webParser = new FfeWebAngleSharp(Provider.Url);
                break;

            case Parser.HttpClient:
                webParser = new FfeWebHttpClient(Provider.Url);
                break;

            case Parser.WebClient:
                webParser = new FfeWebClient(Provider.Url);
                break;

            default:
                break;
            }
            string value = webParser.SelectByCssSelector(Provider.CssSelector);

            decimal quote = decimal.Parse(value);

            return(quote);
        }
Esempio n. 2
0
        public decimal WebSelectByRegEx(Provider Provider)
        {
            IFfeWebParser webParser = null;

            switch (WebParser)
            {
            case Parser.Auto:
                webParser = FfeWebController.AutoWebParserSelection(Provider.Url);
                break;

            case Parser.HAP:
                webParser = new FfeWebHap(Provider.Url);
                break;

            case Parser.AngleSharp:
                webParser = new FfeWebAngleSharp(Provider.Url);
                break;

            case Parser.HttpClient:
                webParser = new FfeWebHttpClient(Provider.Url);
                break;

            case Parser.WebClient:
                webParser = new FfeWebClient(Provider.Url);
                break;

            default:
                break;
            }
            string value = FfeRegEx.RegExByIndexAndGroup(webParser.GetHtml(), Provider.RegExPattern, Provider.RegExMatchIndex.Value, Provider.RegExGroupName);

            decimal quote = decimal.Parse(value);

            return(quote);
        }