internal RhinoFileWatcher(uint runtimeSerialNumber) { try { RuntimeSerialNumber = runtimeSerialNumber; Watcher = new FileSystemWatcher { // Disable watching EnableRaisingEvents = false, // Watch for changes in LastAccess and LastWrite times, and the renaming of files or directories. //ALB - I'm fairly sure we don't need to know when a file was last accessed...and it seems like this would be a bad thing //to notify about. NotifyFilter = /*NotifyFilters.LastAccess | */ NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName, }; // Add event handlers. Watcher.Changed += OnChanged; Watcher.Created += OnChanged; Watcher.Deleted += OnChanged; Watcher.Renamed += OnRenamed; // Make sure they watchers are shutdown when closing Rhino RhinoApp.Closing += (sender, args) => Dispose(); } catch (Exception exception) { RhinoFileEventWatcherHooks.ReportException(exception); } }
internal RhinoFileWatcher(IntPtr pointerToIRhinoFileEventWatcher) { try { Pointer = pointerToIRhinoFileEventWatcher; Watcher = new FileSystemWatcher { // Disable watching EnableRaisingEvents = false, // Watch for changes in LastAccess and LastWrite times, and the renaming of files or directories. NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName, }; // Add event handlers. Watcher.Changed += OnChanged; Watcher.Created += OnChanged; Watcher.Deleted += OnChanged; Watcher.Renamed += OnRenamed; // Make sure they watchers are shutdown when closing Rhino RhinoApp.Closing += (sender, args) => Dispose(); } catch (Exception exception) { RhinoFileEventWatcherHooks.ReportException(exception); } }