Salmon
Loading...
Searching...
No Matches
Mku.Utils.FileCommander Class Reference

Facade class for file operations. More...

Inheritance diagram for Mku.Utils.FileCommander:
Mku.Salmon.Utils.SalmonFileCommander

Classes

class  FileTaskProgress
 File task progress. More...
 
class  IVirtualFileTaskProgress
 Task progress for encrypted file operations. More...
 
class  RealFileTaskProgress
 Task progress for real file operations. More...
 

Public Member Functions

 FileCommander (FileImporter fileImporter, FileExporter fileExporter, FileSearcher fileSearcher)
 Instantiate a new file commander object.
 
virtual IVirtualFile[] ImportFiles (IRealFile[] filesToImport, IVirtualFile importDir, bool deleteSource, bool integrity, Action< RealFileTaskProgress > OnProgressChanged, Func< IRealFile, string > AutoRename, Action< IRealFile, Exception > OnFailed)
 Import files to the drive.
 
IRealFile[] ExportFiles (IVirtualFile[] filesToExport, IRealFile exportDir, bool deleteSource, bool integrity, Action< IVirtualFileTaskProgress > OnProgressChanged, Func< IRealFile, string > AutoRename, Action< IVirtualFile, Exception > OnFailed)
 Export a file from a drive.
 
void DeleteFiles (IVirtualFile[] filesToDelete, Action< IVirtualFileTaskProgress > OnProgressChanged, Action< IVirtualFile, Exception > OnFailed)
 Delete files.
 
void CopyFiles (IVirtualFile[] filesToCopy, IVirtualFile dir, bool move, Action< IVirtualFileTaskProgress > OnProgressChanged, Func< IVirtualFile, string > AutoRename, bool autoRenameFolders, Action< IVirtualFile, Exception > OnFailed)
 Copy files to another directory.
 
void Cancel ()
 Cancel all jobs.
 
bool IsFileSearcherRunning ()
 True if the file search is currently running.
 
bool IsRunning ()
 True if jobs are currently running.
 
bool IsFileSearcherStopped ()
 True if file search stopped.
 
void StopFileSearch ()
 Stop file search.
 
IVirtualFile[] Search (IVirtualFile dir, string terms, bool any, FileSearcher.OnResultFoundListener OnResultFound, Action< FileSearcher.SearchEvent > OnSearchEvent)
 Search.
 
bool AreJobsStopped ()
 True if all jobs are stopped.
 
void Close ()
 Close the file commander and associated resources.
 
void RenameFile (IVirtualFile file, string newFilename)
 Rename an encrypted file.
 

Detailed Description

Facade class for file operations.

Member Function Documentation

◆ AreJobsStopped()

bool Mku.Utils.FileCommander.AreJobsStopped ( )

True if all jobs are stopped.

Returns
True if jobs are stopped

◆ CopyFiles()

void Mku.Utils.FileCommander.CopyFiles ( IVirtualFile[] filesToCopy,
IVirtualFile dir,
bool move,
Action< IVirtualFileTaskProgress > OnProgressChanged,
Func< IVirtualFile, string > AutoRename,
bool autoRenameFolders,
Action< IVirtualFile, Exception > OnFailed )

Copy files to another directory.

Parameters
filesToCopyThe array of files to copy.
dirThe target directory.
moveTrue if moving files instead of copying.
OnProgressChangedThe progress change observer to notify.
AutoRenameThe auto rename function to use when files with same filename are found.
autoRenameFoldersApply autorename to folders also (default is true)
OnFailedThe observer to notify when failures occur.
Exceptions
ExceptionThrown if error during operation

◆ DeleteFiles()

void Mku.Utils.FileCommander.DeleteFiles ( IVirtualFile[] filesToDelete,
Action< IVirtualFileTaskProgress > OnProgressChanged,
Action< IVirtualFile, Exception > OnFailed )

Delete files.

Parameters
filesToDeleteThe array of files to delete.
OnProgressChangedThe progress change observer to notify.
OnFailedThe observer to notify when failures occur.
Exceptions
ExceptionThrown if error during operation

◆ ExportFiles()

IRealFile[] Mku.Utils.FileCommander.ExportFiles ( IVirtualFile[] filesToExport,
IRealFile exportDir,
bool deleteSource,
bool integrity,
Action< IVirtualFileTaskProgress > OnProgressChanged,
Func< IRealFile, string > AutoRename,
Action< IVirtualFile, Exception > OnFailed )

Export a file from a drive.

Parameters
filesToExportThe files to export.
exportDirThe export target directory.
deleteSourceTrue if you want to delete the source files.
integrityTrue to use integrity verification before exporting files
OnProgressChangedObserver to notify when progress changes.
AutoRenameFunction to rename file if another file with the same filename exists.
OnFailedObserver to notify when a file fails exporting.
Returns
True if complete successfully.
Exceptions
ExceptionThrown if error during operation

◆ ImportFiles()

virtual IVirtualFile[] Mku.Utils.FileCommander.ImportFiles ( IRealFile[] filesToImport,
IVirtualFile importDir,
bool deleteSource,
bool integrity,
Action< RealFileTaskProgress > OnProgressChanged,
Func< IRealFile, string > AutoRename,
Action< IRealFile, Exception > OnFailed )
virtual

Import files to the drive.

Parameters
filesToImportThe files to import.
importDirThe target directory.
deleteSourceTrue if you want to delete the source files.
integrityTrue to apply integrity to imported files
OnProgressChangedObserver to notify when progress changes.
AutoRenameFunction to rename file if another file with the same filename exists.
OnFailedObserver to notify when a file fails importing.
Returns
The imported files.
Exceptions
ExceptionThrown if error during operation

Reimplemented in Mku.Salmon.Utils.SalmonFileCommander.

◆ IsFileSearcherRunning()

bool Mku.Utils.FileCommander.IsFileSearcherRunning ( )

True if the file search is currently running.

Returns
True if file search is running

◆ IsFileSearcherStopped()

bool Mku.Utils.FileCommander.IsFileSearcherStopped ( )

True if file search stopped.

Returns
True if file searcher is running

◆ IsRunning()

bool Mku.Utils.FileCommander.IsRunning ( )

True if jobs are currently running.

Returns
True if running

◆ RenameFile()

void Mku.Utils.FileCommander.RenameFile ( IVirtualFile file,
string newFilename )

Rename an encrypted file.

Parameters
fileThe file
newFilenameThe new file name

◆ Search()

IVirtualFile[] Mku.Utils.FileCommander.Search ( IVirtualFile dir,
string terms,
bool any,
FileSearcher.OnResultFoundListener OnResultFound,
Action< FileSearcher.SearchEvent > OnSearchEvent )

Search.

Parameters
dirThe directory to start the search.
termsThe terms to search for.
anyTrue if you want to match any term otherwise match all terms.
OnResultFoundCallback interface to receive notifications when results found.
OnSearchEventCallback interface to receive status events.
Returns
An array with all the results found.

The documentation for this class was generated from the following file: