public ChangeAppConfig(string path) { AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", path); ResetConfigMechanism(); appConfigLogger.Debug("Application configuration changed to: " + path); OnPathChange?.Invoke(this, new AppConfigEventArgs(path)); }
public static FileListener FetchFileListener(string path, OnPathChange listener, string filter = "*.*") { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } if (listener == null) { throw new ArgumentNullException("listener"); } return(new FileListener(path, listener, filter)); }
internal FileListener(string path, OnPathChange listener, string filter) { if (Directory.Exists(path) == false) { return; } _listeningToPath = path; _fileListener = listener; _listeningFilter = filter; _fileSystemWatcher = new FileSystemWatcher(path, filter); _fileSystemWatcher.Changed += OnChanged; _fileSystemWatcher.Created += OnCreated; _fileSystemWatcher.Renamed += OnRenamed; _fileSystemWatcher.Deleted += OnDeleted; Start(); }