IFileWatcher Pennington.Infrastructure
Watches file system paths for changes and notifies subscribers.
Methods
AddPathWatch
#void AddPathWatch(string path, string filePattern, Action<string, WatcherChangeTypes> onFileChanged, bool includeSubdirectories = true);Watch a path for file changes matching a pattern.
Parameters
pathstringfilePatternstringonFileChangedAction<string, WatcherChangeTypes>includeSubdirectoriesbool (optional)
SubscribeToChanges
#void SubscribeToChanges(Action onUpdate);Subscribe to be notified when any watched file changes.
Parameters
onUpdateAction
SubscribeToChanges
#void SubscribeToChanges(Action<FileChangeNotification> onUpdate);Subscribe to be notified when any watched file changes, with the changed path and change type.
Parameters
onUpdateAction<FileChangeNotification>
Pennington.Infrastructure.IFileWatcher
namespace Pennington.Infrastructure;
/// Watches file system paths for changes and notifies subscribers.
public interface IFileWatcher
{
/// Watch a path for file changes matching a pattern.
void AddPathWatch(string path, string filePattern, Action<string, WatcherChangeTypes> onFileChanged, bool includeSubdirectories = true);
/// Subscribe to be notified when any watched file changes.
void SubscribeToChanges(Action onUpdate);
/// Subscribe to be notified when any watched file changes, with the changed path and change type.
void SubscribeToChanges(Action<FileChangeNotification> onUpdate);
}