public void AppendConfig(ModConfiguration config) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } if (!ModManagement.IsInstalled(config.ID)) { Definitions.Add(config); } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
private void ActivateStock_Click(object sender, RoutedEventArgs e) { bool WasPlaying = RussLibraryAudio.AudioServer.Current.IsPlaying; if (WasPlaying) { RussLibraryAudio.AudioServer.Current.Stop(); } if (!ModManagement.IsInstalled(DataStrings.StockID)) { if (!Directory.Exists(System.IO.Path.Combine(Locations.InstalledModsPath, DataStrings.StockID))) { Locations.MessageBoxShow("Stock Mod is not installed and Stock Mod install folder does not exist--cannot continue.", MessageBoxButton.OK, MessageBoxImage.Error); } else { ModConfiguration configuration = new ModConfiguration(DataStrings.ModStockFile); configuration.InstalledPath = System.IO.Path.Combine(Locations.InstalledModsPath, DataStrings.StockID); InstalledModConfigurations.Current.Configurations.Configurations.Insert(0, configuration); InstalledModConfigurations.Current.Save(); } } foreach (ModConfiguration configuration in InstalledModConfigurations.Current.Configurations.Configurations) { if (configuration.ID == DataStrings.StockID) { ModManagement.Activate(configuration); Locations.MessageBoxShow("Activated stock.", MessageBoxButton.OK, MessageBoxImage.Information); } } if (WasPlaying) { RussLibraryAudio.AudioServer.Current.PlayNextInQueue(); } Locations.MessageBoxShow("done.", MessageBoxButton.OK, MessageBoxImage.Information); }