private static void ExposeData(string filepath, bool useUndoAction = false) { try { if (CurrentMode == Mode.Saving) { Data = new ModsConfigData { buildNumber = RimWorld.VersionControl.CurrentBuild, activeMods = ModsConfigHandler.GetActiveMods() }; DirectXmlSaver.SaveDataObject((object)Data, filepath); } else if (CurrentMode == Mode.Loading) { List <string> current = new List <string>(); Data = ReadModList(filepath); ModsConfigHandler.ClearLoadedMods(true); foreach (string modID in Data.activeMods) { ModsConfig.SetActive(modID, true); } } } catch (Exception e) { Main.Log.ReportException(e); ModsConfigHandler.ClearLoadedMods(); } }
static ModListController() { Data = new ModsConfigData { buildNumber = RimWorld.VersionControl.CurrentBuild, activeMods = ModsConfigHandler.GetActiveMods() }; }
/// <summary> /// Import mods from a save file into the current game /// </summary> /// <param name="filename"></param> internal static void ImportMods(string filename) { Read(GenFilePaths.FilePathForSavedGame(filename)); ModsConfigHandler.SetActiveMods(importList); }