/// <summary> /// Clears the current active mods /// </summary> /// <param name="removeCore">Set to true to remove core [Optional](Default:false)</param> internal static void ClearLoadedMods(bool removeCore = false) { ModsConfig.Reset(); if (removeCore) { ModsConfig.SetActive(ModContentPack.CoreModIdentifier, false); } }
/// <summary> /// Deactivate all mods except core /// </summary> public static void Reset() { ModsConfig.Reset(); }
internal static void LoadAllPlayData(bool recovering = false) { if (PlayDataLoader.Loaded) { Log.Error("Loading play data when already loaded. Call ClearAllPlayData first."); } else { queueRecovering = false; queueLoadAllPlayData = false; DeepProfiler.Start("LoadAllPlayData"); try { DoPlayLoad(); } catch (Exception ex) { if (!Prefs.ResetModsConfigOnCrash) { throw; } else if (recovering) { Log.Warning("Could not recover from errors loading play data. Giving up."); throw; } else { IEnumerable <ModMetaData> activeMods = ModsConfig.ActiveModsInLoadOrder; if (Enumerable.Count <ModMetaData>(activeMods) == 1 && Enumerable.First <ModMetaData>(activeMods).IsCoreMod) { throw; } else { Log.Warning("Caught exception while loading play data but there are active mods other than Core. Resetting mods config and trying again.\nThe exception was: " + (object)ex); try { PlayDataLoader.ClearAllPlayData(); } catch { Log.Warning("Caught exception while recovering from errors and trying to clear all play data. Ignoring it.\nThe exception was: " + (object)ex); } ModsConfig.Reset(); CrossRefLoader.Clear(); PostLoadInitter.Clear(); PlayDataLoader.LoadAllPlayData(true); return; } } } finally { DeepProfiler.End(); } // A14 - PlayDataLoader.loaded is now private, Loaded property is getter only PlayDataLoader_loaded.SetValue(null, false); if (!recovering) { return; } Log.Message("Successfully recovered from errors and loaded play data."); DelayedErrorWindowRequest.Add(Translator.Translate("RecoveredFromErrorsText"), Translator.Translate("RecoveredFromErrorsDialogTitle")); } }