diff --git a/src/Loader/BIE/BepInExConfigHandler.cs b/src/Loader/BepInEx/BepInExConfigHandler.cs similarity index 100% rename from src/Loader/BIE/BepInExConfigHandler.cs rename to src/Loader/BepInEx/BepInExConfigHandler.cs diff --git a/src/Loader/BIE/ExplorerBepInPlugin.cs b/src/Loader/BepInEx/ExplorerBepInPlugin.cs similarity index 100% rename from src/Loader/BIE/ExplorerBepInPlugin.cs rename to src/Loader/BepInEx/ExplorerBepInPlugin.cs diff --git a/src/Loader/ML/ExplorerMelonMod.cs b/src/Loader/MelonLoader/ExplorerMelonMod.cs similarity index 100% rename from src/Loader/ML/ExplorerMelonMod.cs rename to src/Loader/MelonLoader/ExplorerMelonMod.cs diff --git a/src/Loader/ML/MelonLoaderConfigHandler.cs b/src/Loader/MelonLoader/MelonLoaderConfigHandler.cs similarity index 96% rename from src/Loader/ML/MelonLoaderConfigHandler.cs rename to src/Loader/MelonLoader/MelonLoaderConfigHandler.cs index 2f6ca3a..5071f6b 100644 --- a/src/Loader/ML/MelonLoaderConfigHandler.cs +++ b/src/Loader/MelonLoader/MelonLoaderConfigHandler.cs @@ -1,77 +1,77 @@ -#if ML -using MelonLoader; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using UnityExplorer.Core; -using UnityExplorer.Core.Config; - -namespace UnityExplorer.Loader.ML -{ - public class MelonLoaderConfigHandler : ConfigHandler - { - internal const string CTG_NAME = "UnityExplorer"; - - internal MelonPreferences_Category prefCategory; - - public override void Init() - { - prefCategory = MelonPreferences.CreateCategory(CTG_NAME, $"{CTG_NAME} Settings", false, true); - } - - public override void LoadConfig() - { - foreach (var entry in ConfigManager.ConfigElements) - { - var key = entry.Key; - if (prefCategory.GetEntry(key) is MelonPreferences_Entry) - { - var config = entry.Value; - config.BoxedValue = config.GetLoaderConfigValue(); - } - } - } - - public override void RegisterConfigElement(ConfigElement config) - { - var entry = prefCategory.CreateEntry(config.Name, config.Value, null, config.Description, config.IsInternal, false); - - entry.OnValueChangedUntyped += () => - { - if ((entry.Value == null && config.Value == null) || config.Value.Equals(entry.Value)) - return; - - config.Value = entry.Value; - }; - } - - public override void SetConfigValue(ConfigElement config, T value) - { - if (prefCategory.GetEntry(config.Name) is MelonPreferences_Entry entry) - { - entry.Value = value; - //entry.Save(); - } - } - - public override T GetConfigValue(ConfigElement config) - { - if (prefCategory.GetEntry(config.Name) is MelonPreferences_Entry entry) - return entry.Value; - - return default; - } - - public override void OnAnyConfigChanged() - { - } - - public override void SaveConfig() - { - MelonPreferences.Save(); - } - } -} +#if ML +using MelonLoader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using UnityExplorer.Core; +using UnityExplorer.Core.Config; + +namespace UnityExplorer.Loader.ML +{ + public class MelonLoaderConfigHandler : ConfigHandler + { + internal const string CTG_NAME = "UnityExplorer"; + + internal MelonPreferences_Category prefCategory; + + public override void Init() + { + prefCategory = MelonPreferences.CreateCategory(CTG_NAME, $"{CTG_NAME} Settings", false, true); + } + + public override void LoadConfig() + { + foreach (var entry in ConfigManager.ConfigElements) + { + var key = entry.Key; + if (prefCategory.GetEntry(key) is MelonPreferences_Entry) + { + var config = entry.Value; + config.BoxedValue = config.GetLoaderConfigValue(); + } + } + } + + public override void RegisterConfigElement(ConfigElement config) + { + var entry = prefCategory.CreateEntry(config.Name, config.Value, null, config.Description, config.IsInternal, false); + + entry.OnValueChangedUntyped += () => + { + if ((entry.Value == null && config.Value == null) || config.Value.Equals(entry.Value)) + return; + + config.Value = entry.Value; + }; + } + + public override void SetConfigValue(ConfigElement config, T value) + { + if (prefCategory.GetEntry(config.Name) is MelonPreferences_Entry entry) + { + entry.Value = value; + //entry.Save(); + } + } + + public override T GetConfigValue(ConfigElement config) + { + if (prefCategory.GetEntry(config.Name) is MelonPreferences_Entry entry) + return entry.Value; + + return default; + } + + public override void OnAnyConfigChanged() + { + } + + public override void SaveConfig() + { + MelonPreferences.Save(); + } + } +} #endif \ No newline at end of file diff --git a/src/Loader/STANDALONE/ExplorerStandalone.cs b/src/Loader/STANDALONE/ExplorerStandalone.cs index a2d8387..9097f50 100644 --- a/src/Loader/STANDALONE/ExplorerStandalone.cs +++ b/src/Loader/STANDALONE/ExplorerStandalone.cs @@ -48,9 +48,6 @@ namespace UnityExplorer /// public static event Action OnLog; - public Harmony HarmonyInstance => s_harmony; - public static readonly Harmony s_harmony = new Harmony(ExplorerCore.GUID); - public ConfigHandler ConfigHandler => _configHandler; private StandaloneConfigHandler _configHandler; diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index b24311c..4ec912a 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -298,13 +298,13 @@ - - + + - - - - + + + +