Exemplo n.º 1
0
		/// <summary>
		///     Возвращает класс, действительно выполняющий поиск элементов
		/// </summary>
		/// <param name="realquery"></param>
		/// <param name="reallanguage"></param>
		/// <returns></returns>
		protected virtual ISelectorImpl ResolveExecutor(string realquery, SelectorLanguage reallanguage) {
			switch (reallanguage) {
				case SelectorLanguage.XPath:
					return XPathSelector ?? (XPathSelector = new XPathSelectorImpl());
				case SelectorLanguage.Regex:
					return RegexSelector ?? (RegexSelector = new RegexSelectorImpl());
				case SelectorLanguage.Css:
					return CssSelector ?? (CssSelector = new CssSelectorImpl());
				case SelectorLanguage.Custom:
					if (null == CustomSelectors) return null;
					return CustomSelectors.FirstOrDefault(_ => _.IsSupported(realquery));
				default:
					return null;
			}
		}
Exemplo n.º 2
0
        /// <summary>
        ///     Возвращает класс, действительно выполняющий поиск элементов
        /// </summary>
        /// <param name="realquery"></param>
        /// <param name="reallanguage"></param>
        /// <returns></returns>
        protected virtual ISelectorImpl ResolveExecutor(string realquery, SelectorLanguage reallanguage)
        {
            switch (reallanguage)
            {
            case SelectorLanguage.XPath:
                return(XPathSelector ?? (XPathSelector = new XPathSelectorImpl()));

            case SelectorLanguage.Regex:
                return(RegexSelector ?? (RegexSelector = new RegexSelectorImpl()));

            case SelectorLanguage.Css:
                return(CssSelector ?? (CssSelector = new CssSelectorImpl()));

            case SelectorLanguage.Custom:
                if (null == CustomSelectors)
                {
                    return(null);
                }
                return(CustomSelectors.FirstOrDefault(_ => _.IsSupported(realquery)));

            default:
                return(null);
            }
        }
Exemplo n.º 3
0
 public void Setup()
 {
     rx = new RegexSelectorImpl();
 }