コード例 #1
0
        private void OnChangedConfig(object source, FileSystemEventArgs e)
        {
            _ = state.ConfigIsUpdatingWaitHandle.Reset();
            state.ConfigIsUpdating = true;
            if (state.SkipConfigFileReload)
            {
                state.SkipConfigFileReload = false;
                Logger.Debug("skipping config file reload, update source internal");
                return;
            }
            try
            {
                AdmConfig oldConfig = builder.Config;
                builder.Load();
                componentManager.UpdateSettings();
                UpdateEventStates();
                builder.OnConfigUpdated(oldConfig);

                // fire warden ro register/unregister enabled/disabled modules
                if (warden != null)
                {
                    warden.Fire();
                }
                Logger.Debug("updated configuration file");
            }
            catch (Exception ex)
            {
                Logger.Debug(ex, "config file load failed:");
            }
            state.ConfigIsUpdating = false;
            if (!state.ConfigIsUpdatingWaitHandle.Set())
            {
                Logger.Fatal("could not trigger reset event");
            }
        }
コード例 #2
0
 private void OnChangedConfig(object source, FileSystemEventArgs e)
 {
     if (!AdmConfigBuilder.IsFileLocked(new FileInfo(configBuilder.ConfigFilePath)))
     {
         try
         {
             configBuilder.Load();
             Logger.Debug("updated configuration file");
         }
         catch (Exception ex)
         {
             Logger.Debug(ex, "config file locked, cannot load");
         }
     }
 }