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
rootstringRoot directory for the watcher
fileSystemWatcherFileSystemWatcherThe wrapped watcher that is watching
rootpollForChangesboolTrue 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
rootstringRoot directory for the watcher
fileSystemWatcherFileSystemWatcherThe wrapped watcher that is watching
rootpollForChangesboolTrue when the watcher should use polling to trigger instances of IChangeToken created by CreateFileChangeToken(string)
filtersExclusionFiltersSpecifies 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
filterstringA globbing pattern for files and directories to watch
Returns
- IChangeToken
A change token for all files that match the filter
Exceptions
- ArgumentNullException
When
filteris null
Dispose()
Disposes the file watcher
public void Dispose()