コード例 #1
0
        public static AsciiFileContents CreateAsciiFileContents(string text)
        {
            var memory   = CreateAsciiMemory(text);
            var contents = new AsciiFileContents(memory, DateTime.Now);

            return(contents);
        }
コード例 #2
0
        public PerThreadCompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions)
        {
            _pattern                     = pattern;
            _searchOptions               = searchOptions;
            _asciiAlgorithmFactory       = x => AsciiFileContents.CreateSearchAlgo(_pattern, _searchOptions);
            _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(_pattern, _searchOptions);

            // Force execution on the current thread so that we get an exception if
            // the search engine finds "pattern" is invalid.
            this.GetAsciiSearch();
        }
コード例 #3
0
        private static List <SearchContentsAlgorithms> CreateSearchAlgorithms(ParsedSearchString parsedSearchString, bool matchCase)
        {
            var searchOptions = matchCase ? NativeMethods.SearchOptions.kMatchCase : NativeMethods.SearchOptions.kNone;

            return(parsedSearchString.EntriesBeforeMainEntry
                   .Concat(new[] { parsedSearchString.MainEntry })
                   .Concat(parsedSearchString.EntriesAfterMainEntry)
                   .OrderBy(x => x.Index)
                   .Select(entry => {
                var a1 = AsciiFileContents.CreateSearchAlgo(entry.Text, searchOptions);
                var a2 = UTF16FileContents.CreateSearchAlgo(entry.Text, searchOptions);
                return new SearchContentsAlgorithms(a1, a2);
            })
                   .ToList());
        }
コード例 #4
0
 public CompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions)
 {
     _asciiCompiledTextSearchAlgo = AsciiFileContents.CreateSearchAlgo(pattern, searchOptions);
     _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(pattern, searchOptions);
 }