The config path was also changed to `BepInEx/config/GBSU/config.json` Tracks the -maplist argument
35 lines
No EOL
863 B
C#
35 lines
No EOL
863 B
C#
using System;
|
|
using System.IO;
|
|
using GB.Config;
|
|
using GBSU.Addons;
|
|
using HarmonyLib;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace GBSU.Patches;
|
|
|
|
[HarmonyPatch]
|
|
class ConfigLoaderPatch
|
|
{
|
|
[HarmonyPatch(typeof(GBConfigLoader), "LoadRotationConfig")]
|
|
private static bool Prefix(ref RotationConfig __result)
|
|
{
|
|
string text = ""; // contents of file
|
|
|
|
Plugin.Log.LogInfo("Loading custom rotation config...");
|
|
|
|
// Reading from file
|
|
try
|
|
{
|
|
text = File.ReadAllText(Helper.GameConfigPath);
|
|
Plugin.Log.LogDebug("Provided rotation config:\n" + text);
|
|
RotationConfig rc = JsonConvert.DeserializeObject<RotationConfig>(text);
|
|
__result = rc;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
GBSUGui.PushError("Couldn't read game config file. A few details:\n" + e);
|
|
}
|
|
|
|
return false; // skip
|
|
}
|
|
} |