/// <summary> /// Saves the KSPConfig to the selected KSP folder. /// </summary> public static void SaveKSPConfig() { try { string path = KSPPathHelper.GetPath(KSPPaths.KSPConfig); if (path != string.Empty && Directory.Exists(Path.GetDirectoryName(path))) { Messenger.AddInfo(Messages.MSG_SAVING_KSP_MOD_SETTINGS); KSPConfig.Save(path, ModSelectionController.Mods); } else { Messenger.AddError(Messages.MSG_KSP_MOD_SETTINGS_PATH_INVALID); } } catch (Exception ex) { Messenger.AddError(Messages.MSG_ERROR_DURING_SAVING_KSP_MOD_SETTINGS, ex); ShowAdminRightsDlg(ex); } }
/// <summary> /// Loads the KSPConfig from the selected KSP folder. /// </summary> protected static void LoadKSPConfig() { ModSelectionController.ClearMods(); string configPath = KSPPathHelper.GetPath(KSPPaths.KSPConfig); if (File.Exists(configPath)) { Messenger.AddInfo(Messages.MSG_LOADING_KSP_MOD_CONFIGURATION); List <ModNode> mods = new List <ModNode>(); KSPConfig.Load(configPath, ref mods); ModSelectionController.AddMods(mods.ToArray()); ModSelectionController.SortModSelection(); } else { Messenger.AddInfo(Messages.MSG_KSP_MOD_CONFIGURATION_NOT_FOUND); } ModSelectionController.RefreshCheckedStateAllMods(); Messenger.AddInfo(Messages.MSG_DONE); }