private void CreateFileWatcher(SettingsType a_SettingsType) { try { string _Path = EnumeratorParser.GetStringValue(a_SettingsType); if (a_SettingsType.Equals(SettingsType.TraneObjectMaps)) { _FullPath = string.IsNullOrEmpty(ConfigurationManager.AppSettings["TraneObjectMapFolder"]) ? Path.Combine(@"C:\SPGateway\Metadata\", _Path) : ConfigurationManager.AppSettings["TraneObjectMapFolder"] + _Path; } else { _FullPath = string.IsNullOrEmpty(ConfigurationManager.AppSettings["PersistenceDirectory"]) ? Path.Combine(@"C:\SPGateway\Settings\", _Path) : ConfigurationManager.AppSettings["PersistenceDirectory"] + _Path; } _FileDirectory = Path.GetDirectoryName(_FullPath); _Filter = Path.GetFileName(_FullPath); FileSystemWatcher a_FileWatcher = new FileSystemWatcher(_FileDirectory, _Filter); a_FileWatcher.NotifyFilter = NotifyFilters.LastWrite; a_FileWatcher.Changed += _FileChanged_Event; a_FileWatcher.EnableRaisingEvents = true; } catch (Exception ex) { if (_Logger != null) { _Logger.LogIf(COMPONENT_NAME, TraceLevel.Error, ex); } } }