Browse Source

Added config flag to disable mod yeeting

Added properties to SelfConfig to make using it better
pull/46/head
Anairkoen Schno 5 years ago
parent
commit
ecbfc6377a
4 changed files with 30 additions and 14 deletions
  1. +2
    -2
      BSIPA-ModList/DownloadController.cs
  2. +20
    -4
      IPA.Loader/Config/SelfConfig.cs
  3. +2
    -2
      IPA.Loader/Loader/PluginManager.cs
  4. +6
    -6
      IPA.Loader/Updating/BeatMods/Updater.cs

+ 2
- 2
BSIPA-ModList/DownloadController.cs View File

@ -41,7 +41,7 @@ namespace BSIPA_ModList
public static DownloadController Create()
{
var inst = new GameObject("BSIPA Modlist Download Controller").AddComponent<DownloadController>();
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();
}


+ 20
- 4
IPA.Loader/Config/SelfConfig.cs View File

@ -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;
}
}

+ 2
- 2
IPA.Loader/Loader/PluginManager.cs View File

@ -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");


+ 6
- 6
IPA.Loader/Updating/BeatMods/Updater.cs View File

@ -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);


Loading…
Cancel
Save