mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-10 09:17:28 +08:00
[F] Nested types patches without enable
This commit is contained in:
@@ -21,16 +21,16 @@ namespace AquaMai
|
|||||||
{
|
{
|
||||||
public static Config AppConfig { get; private set; }
|
public static Config AppConfig { get; private set; }
|
||||||
|
|
||||||
private static void Patch(Type type)
|
private void Patch(Type type)
|
||||||
{
|
{
|
||||||
MelonLogger.Msg($"> Patching {type}");
|
MelonLogger.Msg($"> Patching {type}");
|
||||||
HarmonyLib.Harmony.CreateAndPatchAll(type);
|
HarmonyInstance.PatchAll(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply patches using reflection, based on the settings
|
* Apply patches using reflection, based on the settings
|
||||||
*/
|
*/
|
||||||
private static void ApplyPatches()
|
private void ApplyPatches()
|
||||||
{
|
{
|
||||||
// Iterate over all properties of AppConfig
|
// Iterate over all properties of AppConfig
|
||||||
foreach (var categoryProp in AppConfig.GetType().GetProperties())
|
foreach (var categoryProp in AppConfig.GetType().GetProperties())
|
||||||
@@ -53,7 +53,14 @@ namespace AquaMai
|
|||||||
var directiveType = Type.GetType($"AquaMai.{categoryProp.Name}.{settingProp.Name}");
|
var directiveType = Type.GetType($"AquaMai.{categoryProp.Name}.{settingProp.Name}");
|
||||||
|
|
||||||
// If the type is found, call the Patch method
|
// 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}");
|
else MelonLogger.Error($"Type not found for {categoryProp.Name}.{settingProp.Name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using MelonLoader;
|
|||||||
[assembly: AssemblyFileVersion(AquaMai.BuildInfo.Version)]
|
[assembly: AssemblyFileVersion(AquaMai.BuildInfo.Version)]
|
||||||
[assembly: MelonInfo(typeof(AquaMai.AquaMai), AquaMai.BuildInfo.Name, AquaMai.BuildInfo.Version, AquaMai.BuildInfo.Author, AquaMai.BuildInfo.DownloadLink)]
|
[assembly: MelonInfo(typeof(AquaMai.AquaMai), AquaMai.BuildInfo.Name, AquaMai.BuildInfo.Version, AquaMai.BuildInfo.Author, AquaMai.BuildInfo.DownloadLink)]
|
||||||
[assembly: MelonColor()]
|
[assembly: MelonColor()]
|
||||||
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
// Create and Setup a MelonGame Attribute to mark a Melon as Universal or Compatible with specific Games.
|
// 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.
|
// 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user