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();
    }
        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();
        }
        private static int PerformSearch(
            SafeHeapBlockHandle textBlock,
            ICompiledTextSearch algo,
            int repeat)
        {
            int matchCount = 0;

            for (var i = 0; i < repeat; i++)
            {
                matchCount = algo.FindAll(
                    new TextFragment(textBlock.Pointer, 0, textBlock.ByteLength, sizeof(byte)),
                    x => x,
                    OperationProgressTracker.None).Count();
            }
            return(matchCount);
        }
 private static int PerformSearch(
     SafeHeapBlockHandle textBlock,
     ICompiledTextSearch algo,
     int repeat) {
   int matchCount = 0;
   for (var i = 0; i < repeat; i++) {
     matchCount = algo.FindAll(
       new TextFragment(textBlock.Pointer, 0, textBlock.ByteLength, sizeof (byte)),
       x => x,
       OperationProgressTracker.None).Count();
   }
   return matchCount;
 }
 public CompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions)
 {
     _asciiCompiledTextSearchAlgo = AsciiFileContents.CreateSearchAlgo(pattern, searchOptions);
     _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(pattern, searchOptions);
 }
 public CompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions) {
   _asciiCompiledTextSearchAlgo = AsciiFileContents.CreateSearchAlgo(pattern, searchOptions);
   _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(pattern, searchOptions);
 }