FileSurfer 2.1.2
Cross-platform file manager with support for Git and SFTP
Loading...
Searching...
No Matches
FileSurfer.Core.ViewModels.SearchManager Class Reference

Coordinates cancellable recursive searches across a file system and pushes matching entries to the UI in buffered batches while maintaining a simple animated search status label. More...

Inheritance diagram for FileSurfer.Core.ViewModels.SearchManager:
Collaboration diagram for FileSurfer.Core.ViewModels.SearchManager:

Public Member Functions

 SearchManager (Action< string > updateAnimation, Action< FileSystemEntryViewModel > putEntry)
 Creates a new SearchManager instance.
async Task CancelSearchAsync ()
 Requests cancellation for the currently running search, if any, and waits until the active search task has fully completed.
async Task< int?> SearchAsync (IFileSystem fileSystem, string searchQuery, string dirToSearch)
 Starts a new recursive search from the given directory.
void Dispose ()

Detailed Description

Coordinates cancellable recursive searches across a file system and pushes matching entries to the UI in buffered batches while maintaining a simple animated search status label.

Constructor & Destructor Documentation

◆ SearchManager()

FileSurfer.Core.ViewModels.SearchManager.SearchManager ( Action< string > updateAnimation,
Action< FileSystemEntryViewModel > putEntry )
inline

Creates a new SearchManager instance.

Parameters
updateAnimationCallback invoked whenever the search status label should be updated (for example Searching... and Searching finished).
putEntryCallback invoked for each matching FileSystemEntryViewModel discovered during search result streaming.

Member Function Documentation

◆ CancelSearchAsync()

async Task FileSurfer.Core.ViewModels.SearchManager.CancelSearchAsync ( )
inline

Requests cancellation for the currently running search, if any, and waits until the active search task has fully completed.

Returns
A task that completes once cancellation has been requested and the active search has stopped processing.

◆ Dispose()

void FileSurfer.Core.ViewModels.SearchManager.Dispose ( )
inline

◆ SearchAsync()

async Task< int?> FileSurfer.Core.ViewModels.SearchManager.SearchAsync ( IFileSystem fileSystem,
string searchQuery,
string dirToSearch )
inline

Starts a new recursive search from the given directory.

If another search is already running, it is canceled and awaited before the new one begins.

Parameters
fileSystemFile system abstraction used to enumerate directories and files.
searchQueryCase-insensitive query string matched against entry names.
dirToSearchAbsolute path of the root directory where traversal starts.
Returns
A task that resolves to the number of entries found, or null if the search was canceled before completion.

The documentation for this class was generated from the following file:
  • /home/janecea/Documents/CODE/PROJECTS/FileSurfer/src/FileSurfer.Core/ViewModels/SearchManager.cs