Class DirectoryWatcher
- Namespace
 - RadioExt_Helper.utility
 
- Assembly
 - RadioExt-Helper.dll
 
Encapsulates a FileSystemWatcher to watch a directory for changes.
Subscribe to events to be notified when files are changed, created, deleted, or renamed.
  
  public class DirectoryWatcher
  - Inheritance
 - 
      
      DirectoryWatcher
 
- Inherited Members
 
Constructors
DirectoryWatcher(string, TimeSpan)
Create a new instance of DirectoryWatcher to watch the specified directory for changes.
  
  public DirectoryWatcher(string watchPath, TimeSpan timeWindow)
  Parameters
watchPathstring- The path to watch for changes.
 timeWindowTimeSpan- The time window to wait before processing another event in the same directory.
 
Exceptions
- ArgumentNullException
 - Occurs when the 
watchPathisnullor empty. - ArgumentException
 - Occurs if the directory specified by 
watchPathdoes not exist. 
Methods
Start()
Start watching the directory for changes.
  
  public void Start()
  Stop()
Stop watching the directory for changes.
  
  public void Stop()
  Events
Error
Occurs when the file system watcher encounters an error.
  
  public event EventHandler<Exception>? Error
  Event Type
FileChanged
Occurs when a file in the watched directory is changed.
  
  public event EventHandler<string>? FileChanged
  Event Type
FileCreated
Occurs when a file is created in the watched directory.
  
  public event EventHandler<string>? FileCreated
  Event Type
FileDeleted
Occurs when a file is deleted from the watched directory.
  
  public event EventHandler<string>? FileDeleted
  Event Type
FileRenamed
Occurs when a file is renamed in the watched directory. Event data includes the old and new file paths.
  
  public event EventHandler<(string OldPath, string NewPath)>? FileRenamed