public FileChangeNotifier(string file) { m_log = AppLogger.GetNamedLogger(typeof(FileChangeNotifier)); m_pathToWatch = file; // Create a new FileSystemWatcher and set its properties. m_watcher = new FileSystemWatcher(); m_watcher.Path = Path.GetDirectoryName(m_pathToWatch); m_watcher.Filter = Path.GetFileName(m_pathToWatch); // Set the notification filters m_watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName; // Add event handlers. OnChanged will do for all event handlers that fire a FileSystemEventArgs m_watcher.Changed += new FileSystemEventHandler(ConfigFileWatcher_OnChanged); m_watcher.Created += new FileSystemEventHandler(ConfigFileWatcher_OnChanged); m_watcher.Deleted += new FileSystemEventHandler(ConfigFileWatcher_OnChanged); // Create the timer that will be used to deliver events. Set as disabled m_timer = new Timer(TimerCallback, null, Timeout.Infinite, Timeout.Infinite); m_log.LogInfoMessage("FileChangeNotifier Initialised"); }