Example #1
0
		/// <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;
		}
Example #2
0
 /// <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);
 }
Example #3
0
		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);
		}
Example #4
0
		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,
			};
		}
Example #5
0
        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>());
            }
        }
Example #6
0
		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();
				}
			}
		}
Example #7
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 = 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>());
			}
		}