private static void DoOnConfigFileChanged(FileSystemEventArgs e) { if (IgnorePhysicalConfigChange) { return; } var bDoOnConfigChange = false; lock (Lockobject) { switch (e.ChangeType) { case WatcherChangeTypes.Created: case WatcherChangeTypes.Deleted: case WatcherChangeTypes.Changed: { ReflectInsightConfig appConfig = ReadAndCreateConfigObject(e.FullPath); if (appConfig != null && appConfig.GetBaseConfigChangeAttribute("enabled", "true") == "false") { break; } bDoOnConfigChange = true; // if config mode is either ApplicationExternal or External, then do the following if (CurrentConfigurationMode == ConfigurationMode.Application || e.FullPath.ToLower() != LastConfigFullPath.ToLower()) { // Although the mode can either be Application or Application External, // the app config file is the only file that has changed if we get here. var activeFileName = (string)null; appConfig = GetActiveApplicationConfig(appConfig, out activeFileName); if (e.FullPath.ToLower() != activeFileName.ToLower()) { // this tells us that the app config is not the active config file // and/or that the last external app config is not the same as the previous external app config if (activeFileName.ToLower() != LastConfigFullPath.ToLower()) { LastConfigFullPath = activeFileName; CurrentConfigurationMode = ConfigurationMode.ApplicationExternal; CreateExternConfigFileWatcher(LastConfigFullPath); } else { // only the app config has changed but external remains the same bDoOnConfigChange = false; } } else { LastConfigFullPath = activeFileName; CurrentConfigurationMode = ConfigurationMode.Application; DisposeExternConfigFileWatcher(); } } if (bDoOnConfigChange) { SetAssignedConfig(appConfig); } } break; } } if (bDoOnConfigChange) { Control.ForceConfigChange(); } }