Class PhysicalFilesWatcher
- Namespace
- Acuit.Pinpoint.FileProviders.Physical
- Assembly
- Acuit.Pinpoint.Configuration.dll
A file watcher that watches a physical filesystem for changes.
Triggers events on IChangeToken when files are created, change, renamed, or deleted.
public class PhysicalFilesWatcher : IDisposable
- Inheritance
-
PhysicalFilesWatcher
- Implements
- Inherited Members
Constructors
PhysicalFilesWatcher(string, FileSystemWatcher, bool)
Initializes an instance of PhysicalFilesWatcher that watches files in root
.
Wraps an instance of FileSystemWatcher
public PhysicalFilesWatcher(string root, FileSystemWatcher fileSystemWatcher, bool pollForChanges)
Parameters
root
stringRoot directory for the watcher
fileSystemWatcher
FileSystemWatcherThe wrapped watcher that is watching
root
pollForChanges
boolTrue when the watcher should use polling to trigger instances of IChangeToken created by CreateFileChangeToken(string)
PhysicalFilesWatcher(string, FileSystemWatcher, bool, ExclusionFilters)
Initializes an instance of PhysicalFilesWatcher that watches files in root
.
Wraps an instance of FileSystemWatcher
public PhysicalFilesWatcher(string root, FileSystemWatcher fileSystemWatcher, bool pollForChanges, ExclusionFilters filters)
Parameters
root
stringRoot directory for the watcher
fileSystemWatcher
FileSystemWatcherThe wrapped watcher that is watching
root
pollForChanges
boolTrue when the watcher should use polling to trigger instances of IChangeToken created by CreateFileChangeToken(string)
filters
ExclusionFiltersSpecifies which files or directories are excluded. Notifications of changes to are not raised to these.
Methods
CreateFileChangeToken(string)
Creates an instance of IChangeToken for all files and directories that match the
filter
Globbing patterns are relative to the root directory given in the constructor PhysicalFilesWatcher(string, FileSystemWatcher, bool). Globbing patterns are interpreted by Matcher.
public IChangeToken CreateFileChangeToken(string filter)
Parameters
filter
stringA globbing pattern for files and directories to watch
Returns
- IChangeToken
A change token for all files that match the filter
Exceptions
- ArgumentNullException
When
filter
is null
Dispose()
Disposes the file watcher
public void Dispose()