static void Main(string[] args) { var consoleTracer = new ConsoleTraceListener(true); Trace.Listeners.Add(consoleTracer); consoleTracer.Name = "ManualFileSystemWatcherTrace"; var dir = @"c:\test\manual"; if (args.Count() > 0) { dir = args[0]; } Console.WriteLine($"Scan directory: {dir}"); //SimpleTestCreateNewFile s = new SimpleTestCreateNewFile(); s.TestNewFiles(); return; ManualScanPhysicalFileSystemWatcherSettings settings = new ManualScanPhysicalFileSystemWatcherSettings { ScanDirectory = dir, ScanSpeedInSeconds = 1 }; ManualScanPhysicalFileSystemWatcher w = new ManualScanPhysicalFileSystemWatcher(settings); w.Open(new FilterAndCallbackArgument(String.Empty, CallbackChanges)); // Uncomment for Physical file watcher - for testing purposes only //PhysicalFileSystemWatcherWrapperSettings settingsP = // new PhysicalFileSystemWatcherWrapperSettings { ScanDirectory = dir }; //PhysicalFileSystemWatcherWrapper wP = new PhysicalFileSystemWatcherWrapper(settingsP); //wP.Open(new FilterAndCallbackArgument(String.Empty, CallbackChanges)); Console.WriteLine("Waiting for file changes\r\n\r\n"); Console.ReadLine(); }
public ManualScanPhysicalFileSystemWatcher(ManualScanPhysicalFileSystemWatcherSettings watcherSettings = null, IManualScanDirectory scanDirectory = null) { _settings = watcherSettings ?? new ManualScanPhysicalFileSystemWatcherSettings(); _scanDirectory = scanDirectory ?? new ManualScanDirectory(); }