Only DotNet Standard 2.0 expert . please check the details in below
Filesystem Watcher (in DotNet Standard 2.0)
- DotNet Standard 2.0 project as class library, which implements a Filesystem Watcher.
It should run in the background, so it is best to run it on a separate Thread.
Use an interface IFileWatcher and implement it with a class FileWatcher.
It should receive a list of files and a list of folders to be monitored, or even a list of drives, and monitor all of the specified files and folders.
It should receive a list of files and folders and drives to be monitored via [login to view URL], but be overridable by the caller.
For folders there should be a enum to indicate if it only needs to monitor the folder, or folder and containing files and folder, or folder plus everything beneath it (recursive). This enum should be specified for every informed folder (having as default only the folder).
It should be implemented with the filewatcher class, using the Compatibility Pack for DotNet Core 2.1, so that Windows APIs can be used in DotNet Standard. As this needs to run only in Windows (8, 8.1, 10), and in Windows Server (2012, 2012 R2, 2016), it should be compatible with FAT, NTFS, and ReFS filesystems.
It should be capable to receive a callback method specified by the caller, which will be invoked on each of these events (one callback per event):
- File or Folder created
- File or Folder modified (writes to the file or folder)
- File or Folder renamed
- File or Folder deleted
- File or Folder properties changed (read-only, compress, archive)
- File or Folder ACL changed (any permission (ACE) added, removed or modified)
- DotNet Core 2.1 project as console application, which starts the class library.
It should use Autofac dependency injection to inject IFileWatcher and receive FileWatcher class. And run its thread to start watching.
Specify one callback method for each of the abovementioned events, only writing a line on the console with the event type + full ath of the affected file.
Pass te callback of each of the abovementioned events to the class library.
Stop the class library thread and afterwards the application when the user presses ESC (but inform this on the console as well).
- DotNet Core 2.1 NUnit unit tests project to test all the functionalities.
Gather [login to view URL] and start the class library in a separate thread, create and pass the same callback methods as on the console application.
Run a series of tests by doing 1000 operations of each abovementioned type. Validate that the callback methods of the event have been called for all the times to guarantee that all events are raised when an operation occurs.
Visual Studio 2017 solution with:
- DotNet Standard 2.0 class library
- DotNet Core 2.1 console application
- DotNet Core 2.1 NUnit unit-test project