Пример #1
0
        public static ICompiledTextSearch CreateSearchAlgo(string pattern, SearchProviderOptions searchOptions)
        {
            var options = NativeMethods.SearchOptions.kNone;

            if (searchOptions.MatchCase)
            {
                options |= NativeMethods.SearchOptions.kMatchCase;
            }
            if (searchOptions.MatchWholeWord)
            {
                options |= NativeMethods.SearchOptions.kMatchWholeWord;
            }

            if (searchOptions.UseRegex && searchOptions.UseRe2Engine)
            {
                return(new AsciiCompiledTextSearchRe2(pattern, options));
            }

            if (searchOptions.UseRegex)
            {
                return(new AsciiCompiledTextSearchRegex(pattern, options));
            }

            if (pattern.Length <= 64)
            {
                return(new AsciiCompiledTextSearchBndm64(pattern, options));
            }

            return(new AsciiCompiledTextSearchBoyerMoore(pattern, options));
        }
Пример #2
0
        public static CompiledTextSearchBase CreateSearchAlgo(
            string pattern,
            SearchProviderOptions searchOptions)
        {
            var options = NativeMethods.SearchOptions.kNone;

            if (searchOptions.MatchCase)
            {
                options |= NativeMethods.SearchOptions.kMatchCase;
            }
            if (searchOptions.MatchWholeWord)
            {
                options |= NativeMethods.SearchOptions.kMatchWholeWord;
            }
            return(new Utf16CompiledTextSearchStdSearch(pattern, options));
        }