Esempio n. 1
0
        public async Task SearchAsync()
        {
            Window.ShowStatusProgress($"Searching files for '{SearchPhrase}'");

            var finder = new FindInFilesFinder(SearchFolder, FileFilters);

            finder.SearchSubFolders = SearchSubFolders;
            var result = await finder.SearchFilesAsync(SearchPhrase);

            if (result != null)
            {
                SearchResults = new ObservableCollection <SearchFileResult>(result.OrderBy(r => r.FilePath + "!" + r.FileOnly));
            }
            else
            {
                SearchResults = new ObservableCollection <SearchFileResult>();
            }

            if (result.Count < 1)
            {
                Window.ShowStatusError("No matching files found.");
            }
            else
            {
                Window.ShowStatusSuccess($"{result.Count} file{(result.Count > 1 ? "s" : "")} found.");
            }
        }
Esempio n. 2
0
        public async Task SearchInFilesAsyncTest()
        {
            var finder = new FindInFilesFinder(STR_Folder, "*.*");

            var result = await finder.SearchFilesAsync("Single line breaks");

            Assert.IsTrue(result.Count > 0, "No matches - should have matched");
            WriteResult(result);
        }