C# Class FileSystem.FileMonitor

Monitors a file for changes. It uses the FileSystemWatcher and debounce the events to make sure only one event is fired for a change of a file. Note: If a file is used in different contexts than FileMonitor will fire for each context.
Inheritance: IFileMonitor
Show file Open project: Helmut-Ortmann/EnterpriseArchitect_hoTools Class Usage Examples

Public Methods

Method Description
FileMonitor ( string filePath ) : System

Parameterize FileSystemWatcher

Start ( ) : void

Start Watching the file

Stop ( ) : void

Stop watching the file

Update ( string filePath ) : void

Update the fileName to watch for changes

Private Methods

Method Description
FindReadyPaths ( DateTime>.Dictionary events ) : List

Return list of files which haven't received an change event for TIME_WITOUT_EVENT_MS.

FireEvent ( string path ) : void
OnChange ( object sender, FileSystemEventArgs e ) : void

OnChange Event from System FileSystemWatcher after file has changed. It enters all events with the last event time in the pending event list.

OnFileError ( object o, ErrorEventArgs e ) : void

Handle error from FileSystemWatcher

OnTimeout ( object state ) : void

Timeout

Method Details

FileMonitor() public method

Parameterize FileSystemWatcher
public FileMonitor ( string filePath ) : System
filePath string
return System

Start() public method

Start Watching the file
public Start ( ) : void
return void

Stop() public method

Stop watching the file
public Stop ( ) : void
return void

Update() public method

Update the fileName to watch for changes
public Update ( string filePath ) : void
filePath string
return void