From 2d46cb5a9c351b1900b5c2672471f55b9a5ea9b9 Mon Sep 17 00:00:00 2001 From: Maik Toepfer Date: Wed, 7 Dec 2022 16:29:50 +0100 Subject: [PATCH 1/2] extract interface --- Source/FileWatcherEx/FileSystemWatcherEx.cs | 2 +- Source/FileWatcherEx/IFileSystemWatcherEx.cs | 85 ++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 Source/FileWatcherEx/IFileSystemWatcherEx.cs diff --git a/Source/FileWatcherEx/FileSystemWatcherEx.cs b/Source/FileWatcherEx/FileSystemWatcherEx.cs index 8bc5e02..8eb9d23 100644 --- a/Source/FileWatcherEx/FileSystemWatcherEx.cs +++ b/Source/FileWatcherEx/FileSystemWatcherEx.cs @@ -8,7 +8,7 @@ namespace FileWatcherEx; /// A wrapper of to standardize the events /// and avoid false change notifications. /// -public class FileSystemWatcherEx : IDisposable +public class FileSystemWatcherEx : IDisposable, IFileSystemWatcherEx { #region Private Properties diff --git a/Source/FileWatcherEx/IFileSystemWatcherEx.cs b/Source/FileWatcherEx/IFileSystemWatcherEx.cs new file mode 100644 index 0000000..ea7d1b8 --- /dev/null +++ b/Source/FileWatcherEx/IFileSystemWatcherEx.cs @@ -0,0 +1,85 @@ +using System.ComponentModel; + +namespace FileWatcherEx; + +public interface IFileSystemWatcherEx +{ + /// + /// Gets or sets the path of the directory to watch. + /// + string FolderPath { get; set; } + + /// + /// Gets the collection of all the filters used to determine what files are monitored in a directory. + /// + System.Collections.ObjectModel.Collection Filters { get; } + + /// + /// Gets or sets the filter string used to determine what files are monitored in a directory. + /// + string Filter { get; set; } + + /// + /// Gets or sets the type of changes to watch for. + /// The default is the bitwise OR combination of + /// , + /// , + /// and . + /// + NotifyFilters NotifyFilter { get; set; } + + /// + /// Gets or sets a value indicating whether subdirectories within the specified path should be monitored. + /// + bool IncludeSubdirectories { get; set; } + + /// + /// Gets or sets the object used to marshal the event handler calls issued as a result of a directory change. + /// + ISynchronizeInvoke? SynchronizingObject { get; set; } + + /// + /// Occurs when a file or directory in the specified + /// is changed. + /// + event FileSystemWatcherEx.DelegateOnChanged? OnChanged; + + /// + /// Occurs when a file or directory in the specified + /// is deleted. + /// + event FileSystemWatcherEx.DelegateOnDeleted? OnDeleted; + + /// + /// Occurs when a file or directory in the specified + /// is created. + /// + event FileSystemWatcherEx.DelegateOnCreated? OnCreated; + + /// + /// Occurs when a file or directory in the specified + /// is renamed. + /// + event FileSystemWatcherEx.DelegateOnRenamed? OnRenamed; + + /// + /// Occurs when the instance of is unable to continue + /// monitoring changes or when the internal buffer overflows. + /// + event FileSystemWatcherEx.DelegateOnError? OnError; + + /// + /// Start watching files + /// + void Start(); + + /// + /// Stop watching files + /// + void Stop(); + + /// + /// Dispose the FileWatcherEx instance + /// + void Dispose(); +} \ No newline at end of file From 646f197ea3055590cc49b576f5a56d65c1883c23 Mon Sep 17 00:00:00 2001 From: Maik Toepfer Date: Wed, 7 Dec 2022 16:34:15 +0100 Subject: [PATCH 2/2] newline --- Source/FileWatcherEx/IFileSystemWatcherEx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/FileWatcherEx/IFileSystemWatcherEx.cs b/Source/FileWatcherEx/IFileSystemWatcherEx.cs index ea7d1b8..8da53ed 100644 --- a/Source/FileWatcherEx/IFileSystemWatcherEx.cs +++ b/Source/FileWatcherEx/IFileSystemWatcherEx.cs @@ -82,4 +82,4 @@ public interface IFileSystemWatcherEx /// Dispose the FileWatcherEx instance /// void Dispose(); -} \ No newline at end of file +}