/// <summary> /// Copies this instance to <paramref name="other"/> and returns it /// </summary> /// <param name="other">Destination</param> /// <returns></returns> public FileSearcherOptions CopyTo(FileSearcherOptions other) { other.MaxResults = MaxResults; other.SearchComparer = SearchComparer; other.Filter = Filter; other.SearchDecompiledData = SearchDecompiledData; return other; }
/// <summary> /// Copies this instance to <paramref name="other"/> and returns it /// </summary> /// <param name="other">Destination</param> /// <returns></returns> public FileSearcherOptions CopyTo(FileSearcherOptions other) { other.MaxResults = MaxResults; other.SearchComparer = SearchComparer; other.Filter = Filter; other.SearchDecompiledData = SearchDecompiledData; return(other); }
public IFileSearcher Create(FileSearcherOptions options) { var searchResultContext = new SearchResultContext { SyntaxHighlight = true, Language = languageManager.Language, ImageManager = imageManager, BackgroundType = BackgroundType.Search, }; return new FileSearcher(options, fileTreeView, dotNetImageManager, searchResultContext); }
public FileSearcher(FileSearcherOptions options, IFileTreeView fileTreeView, DotNetImageManager dotNetImageManager, SearchResultContext searchResultContext) { if (options.Filter == null) throw new ArgumentException("options.Filter is null", "options"); if (options.SearchComparer == null) throw new ArgumentException("options.SearchComparer is null", "options"); this.options = options.Clone(); this.cancellationTokenSource = new CancellationTokenSource(); this.filterSearcherOptions = new FilterSearcherOptions { Dispatcher = Dispatcher.CurrentDispatcher, FileTreeView = fileTreeView, DotNetImageManager = dotNetImageManager, Filter = options.Filter, SearchComparer = options.SearchComparer, OnMatch = r => AddSearchResult(r), Context = searchResultContext, CancellationToken = this.cancellationTokenSource.Token, SearchDecompiledData = options.SearchDecompiledData, }; }
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 = SearchDecompiledData, }; fileSearcher = fileSearcherCreator.Create(options); fileSearcher.SyntaxHighlight = SyntaxHighlight; fileSearcher.Language = Language; fileSearcher.BackgroundType = BackgroundType; fileSearcher.OnSearchCompleted += FileSearcher_OnSearchCompleted; fileSearcher.OnNewSearchResults += FileSearcher_OnNewSearchResults; fileSearcher.Start(fileTreeView.TreeView.Root.DataChildren.OfType<IDnSpyFileNode>()); } }
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 = fileSearcherCreator.Create(options); fileSearcher.SyntaxHighlight = SearchSettings.SyntaxHighlight; fileSearcher.Language = Language; 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(); } } }
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 = fileSearcherCreator.Create(options); fileSearcher.SyntaxHighlight = SyntaxHighlight; fileSearcher.Language = Language; fileSearcher.BackgroundType = BackgroundType.Search; fileSearcher.OnSearchCompleted += FileSearcher_OnSearchCompleted; fileSearcher.OnNewSearchResults += FileSearcher_OnNewSearchResults; fileSearcher.Start(fileTreeView.TreeView.Root.DataChildren.OfType<IDnSpyFileNode>()); } }