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(text); __result = rc; } catch (Exception e) { GBSUGui.PushError("Couldn't read game config file. A few details:\n" + e); } return false; // skip } }