mirror of https://github.com/hykilpikonna/AquaDX
[F] Nested types patches without enable
parent
9b7f2b3a79
commit
d9fc262003
|
@ -21,16 +21,16 @@ namespace AquaMai
|
|||
{
|
||||
public static Config AppConfig { get; private set; }
|
||||
|
||||
private static void Patch(Type type)
|
||||
private void Patch(Type type)
|
||||
{
|
||||
MelonLogger.Msg($"> Patching {type}");
|
||||
HarmonyLib.Harmony.CreateAndPatchAll(type);
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply patches using reflection, based on the settings
|
||||
*/
|
||||
private static void ApplyPatches()
|
||||
private void ApplyPatches()
|
||||
{
|
||||
// Iterate over all properties of AppConfig
|
||||
foreach (var categoryProp in AppConfig.GetType().GetProperties())
|
||||
|
@ -53,7 +53,14 @@ namespace AquaMai
|
|||
var directiveType = Type.GetType($"AquaMai.{categoryProp.Name}.{settingProp.Name}");
|
||||
|
||||
// If the type is found, call the Patch method
|
||||
if (directiveType != null) Patch(directiveType);
|
||||
if (directiveType != null)
|
||||
{
|
||||
Patch(directiveType);
|
||||
foreach (var nested in directiveType.GetNestedTypes())
|
||||
{
|
||||
Patch(nested);
|
||||
}
|
||||
}
|
||||
else MelonLogger.Error($"Type not found for {categoryProp.Name}.{settingProp.Name}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,9 @@ using MelonLoader;
|
|||
[assembly: AssemblyFileVersion(AquaMai.BuildInfo.Version)]
|
||||
[assembly: MelonInfo(typeof(AquaMai.AquaMai), AquaMai.BuildInfo.Name, AquaMai.BuildInfo.Version, AquaMai.BuildInfo.Author, AquaMai.BuildInfo.DownloadLink)]
|
||||
[assembly: MelonColor()]
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
// Create and Setup a MelonGame Attribute to mark a Melon as Universal or Compatible with specific Games.
|
||||
// If no MelonGame Attribute is found or any of the Values for any MelonGame Attribute on the Melon is null or empty it will be assumed the Melon is Universal.
|
||||
// Values for MelonGame Attribute can be found in the Game's app.info file or printed at the top of every log directly beneath the Unity version.
|
||||
[assembly: MelonGame(null, null)]
|
||||
[assembly: MelonGame(null, null)]
|
||||
|
|
Loading…
Reference in New Issue