diff --git a/BSIPA-ModList/DownloadController.cs b/BSIPA-ModList/DownloadController.cs index cc3cf405..50ed5b4f 100644 --- a/BSIPA-ModList/DownloadController.cs +++ b/BSIPA-ModList/DownloadController.cs @@ -41,7 +41,7 @@ namespace BSIPA_ModList public static DownloadController Create() { var inst = new GameObject("BSIPA Modlist Download Controller").AddComponent(); - if (IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates) + if (IPA.Config.SelfConfig.Updates_.AutoCheckUpdates_) inst.StartCoroutine(inst.StartUpdateCheck()); return inst; } @@ -149,7 +149,7 @@ namespace BSIPA_ModList if (downloads.Count == 0) OnAllDownloadsCompleted(false); - else if (IPA.Config.SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate) + else if (IPA.Config.SelfConfig.Updates_.AutoUpdate_) StartDownloads(); } diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index af5a45dd..90e0b5e7 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -45,26 +45,42 @@ namespace IPA.Config public bool Regenerate = true; - public class UpdateObject + public class Updates_ { public bool AutoUpdate = true; + public static bool AutoUpdate_ => SelfConfigRef.Value.Updates.AutoUpdate; + public bool AutoCheckUpdates = true; + public static bool AutoCheckUpdates_ => SelfConfigRef.Value.Updates.AutoCheckUpdates; } - public UpdateObject Updates = new UpdateObject(); + public Updates_ Updates = new Updates_(); - public class DebugObject + public class Debug_ { public bool ShowCallSource = false; + public static bool ShowCallSource_ => SelfConfigRef.Value.Debug.ShowCallSource; + public bool ShowDebug = false; + public static bool ShowDebug_ => SelfConfigRef.Value.Debug.ShowDebug; + public bool ShowHandledErrorStackTraces = false; + public static bool ShowHandledErrorStackTraces_ => SelfConfigRef.Value.Debug.ShowHandledErrorStackTraces; + public bool HideMessagesForPerformance = true; + public static bool HideMessagesForPerformance_ => SelfConfigRef.Value.Debug.HideMessagesForPerformance; + public int HideLogThreshold = 512; + public static int HideLogThreshold_ => SelfConfigRef.Value.Debug.HideLogThreshold; } - public DebugObject Debug = new DebugObject(); + public Debug_ Debug = new Debug_(); + + public bool YeetMods = true; + public static bool YeetMods_ => SelfConfigRef.Value.YeetMods; [JsonProperty(Required = Required.Default)] public string LastGameVersion = null; + public static string LastGameVersion_ => SelfConfigRef.Value.LastGameVersion; } } \ No newline at end of file diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 78aa4378..d5f37173 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -299,10 +299,10 @@ namespace IPA.Loader { string pluginDir = BeatSaber.PluginsPath; var gameVer = BeatSaber.GameVersion; - var lastVerS = SelfConfig.SelfConfigRef.Value.LastGameVersion; + var lastVerS = SelfConfig.LastGameVersion_; var lastVer = lastVerS != null ? new AlmostVersion(lastVerS, gameVer) : null; - if (lastVer != null && gameVer != lastVer) + if (SelfConfig.YeetMods_ && lastVer != null && gameVer != lastVer) { var oldPluginsName = Path.Combine(BeatSaber.InstallPath, $"Old {lastVer} Plugins"); var newPluginsName = Path.Combine(BeatSaber.InstallPath, $"Old {gameVer} Plugins"); diff --git a/IPA.Loader/Updating/BeatMods/Updater.cs b/IPA.Loader/Updating/BeatMods/Updater.cs index ae504c99..2aef1cfa 100644 --- a/IPA.Loader/Updating/BeatMods/Updater.cs +++ b/IPA.Loader/Updating/BeatMods/Updater.cs @@ -48,7 +48,7 @@ namespace IPA.Updating.BeatMods { Instance = this; DontDestroyOnLoad(this); - if (!ModListPresent && SelfConfig.SelfConfigRef.Value.Updates.AutoCheckUpdates) + if (!ModListPresent && SelfConfig.Updates_.AutoCheckUpdates_) CheckForUpdates(); } } @@ -303,7 +303,7 @@ namespace IPA.Updating.BeatMods onComplete?.Invoke(depList); - if (!ModListPresent && SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate) + if (!ModListPresent && SelfConfig.Updates_.AutoUpdate_) StartDownload(depList.Value); } @@ -321,7 +321,7 @@ namespace IPA.Updating.BeatMods catch (Exception e) { Logger.updater.Error($"Error getting info for {dep.Name}"); - if (SelfConfig.SelfConfigRef.Value.Debug.ShowHandledErrorStackTraces) + if (SelfConfig.Debug_.ShowHandledErrorStackTraces_) Logger.updater.Error(e); dep.MetaRequestFailed = true; continue; @@ -388,7 +388,7 @@ namespace IPA.Updating.BeatMods catch (Exception e) { Logger.updater.Error($"Error getting mod list for {dep.Name}"); - if (SelfConfig.SelfConfigRef.Value.Debug.ShowHandledErrorStackTraces) + if (SelfConfig.Debug_.ShowHandledErrorStackTraces_) Logger.updater.Error(e); dep.MetaRequestFailed = true; continue; @@ -474,7 +474,7 @@ namespace IPA.Updating.BeatMods catch (Exception e) { Logger.updater.Error($"Error occurred while trying to get information for {item}"); - if (SelfConfig.SelfConfigRef.Value.Debug.ShowHandledErrorStackTraces) + if (SelfConfig.Debug_.ShowHandledErrorStackTraces_) Logger.updater.Error(e); yield break; } @@ -547,7 +547,7 @@ namespace IPA.Updating.BeatMods else Logger.updater.Error($"Error downloading mod {item.Name}"); - if (SelfConfig.SelfConfigRef.Value.Debug.ShowHandledErrorStackTraces) + if (SelfConfig.Debug_.ShowHandledErrorStackTraces_) Logger.updater.Error(downloadTask.Exception); installFail?.Invoke(item, downloadTask.Exception);