コード例 #1
0
ファイル: SearchControlVM.cs プロジェクト: rdavydov/dnSpy
        void StartSearch()
        {
            if (!CanSearch)
            {
                Clear();
                return;
            }

            CancelSearch();
            if (string.IsNullOrEmpty(SearchText))
            {
                SearchResults.Clear();
            }
            else
            {
                var options = new FileSearcherOptions {
                    SearchComparer       = CreateSearchComparer(),
                    Filter               = new FlagsFileTreeNodeFilter(selectedSearchTypeVM.Flags),
                    SearchDecompiledData = SearchSettings.SearchDecompiledData,
                };
                fileSearcher = fileSearcherProvider.Create(options);
                fileSearcher.SyntaxHighlight     = SearchSettings.SyntaxHighlight;
                fileSearcher.Decompiler          = Decompiler;
                fileSearcher.BackgroundType      = BackgroundType;
                fileSearcher.OnSearchCompleted  += FileSearcher_OnSearchCompleted;
                fileSearcher.OnNewSearchResults += FileSearcher_OnNewSearchResults;

                switch ((SearchLocation)SearchLocationVM.SelectedItem)
                {
                case SearchLocation.AllFiles:
                    fileSearcher.Start(GetAllFilesToSearch());
                    break;

                case SearchLocation.SelectedFiles:
                    fileSearcher.Start(GetSelectedFilesToSearch());
                    break;

                case SearchLocation.AllFilesInSameDir:
                    fileSearcher.Start(GetAllFilesInSameDirToSearch());
                    break;

                case SearchLocation.SelectedType:
                    fileSearcher.Start(GetSelectedTypeToSearch());
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
        }
コード例 #2
0
 void StartSearch()
 {
     CancelSearch();
     if (string.IsNullOrEmpty(SearchText))
     {
         SearchResults.Clear();
     }
     else
     {
         var options = new FileSearcherOptions {
             SearchComparer       = SearchComparerFactory.Create(SearchText, CaseSensitive, MatchWholeWords, MatchAnySearchTerm),
             Filter               = filter,
             SearchDecompiledData = false,
         };
         fileSearcher = fileSearcherProvider.Create(options);
         fileSearcher.SyntaxHighlight     = SyntaxHighlight;
         fileSearcher.Decompiler          = Language;
         fileSearcher.BackgroundType      = BackgroundType.Search;
         fileSearcher.OnSearchCompleted  += FileSearcher_OnSearchCompleted;
         fileSearcher.OnNewSearchResults += FileSearcher_OnNewSearchResults;
         fileSearcher.Start(fileTreeView.TreeView.Root.DataChildren.OfType <IDnSpyFileNode>());
     }
 }