mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
target non public getters and setters
This commit is contained in:
2 files changed
+6
-7
No files matched your search
@@ -80,7 +80,6 @@ public sealed class ModdedOptionVisibilityAttribute(string? memberName = null, T
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dynamicMethod = new DynamicMethod($"GetVisibility_{type.Name}_{field.Name}", typeof(bool), Type.EmptyTypes, type, true);
|
var dynamicMethod = new DynamicMethod($"GetVisibility_{type.Name}_{field.Name}", typeof(bool), Type.EmptyTypes, type, true);
|
||||||
|
|
||||||
var il = dynamicMethod.GetILGenerator();
|
var il = dynamicMethod.GetILGenerator();
|
||||||
|
|
||||||
if (instanceGetter != null)
|
if (instanceGetter != null)
|
||||||
|
|||||||
@@ -164,11 +164,11 @@ public static class ModdedOptionsManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var setterOriginal = property.GetSetMethod();
|
var setterOriginal = property.GetSetMethod(true);
|
||||||
var setterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertySetterPatch));
|
var setterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertySetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(setterOriginal, postfix: new HarmonyMethod(setterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(setterOriginal, postfix: new HarmonyMethod(setterPatch));
|
||||||
|
|
||||||
var getterOriginal = property.GetGetMethod();
|
var getterOriginal = property.GetGetMethod(true);
|
||||||
var getterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyGetterPatch));
|
var getterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyGetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(getterOriginal, prefix: new HarmonyMethod(getterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(getterOriginal, prefix: new HarmonyMethod(getterPatch));
|
||||||
|
|
||||||
@@ -269,11 +269,11 @@ public static class ModdedOptionsManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var setterOriginal = property.GetSetMethod();
|
var setterOriginal = property.GetSetMethod(true);
|
||||||
var setterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertySetterPatch));
|
var setterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertySetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(setterOriginal, postfix: new HarmonyMethod(setterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(setterOriginal, postfix: new HarmonyMethod(setterPatch));
|
||||||
|
|
||||||
var getterOriginal = property.GetGetMethod();
|
var getterOriginal = property.GetGetMethod(true);
|
||||||
var getterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyGetterPatch));
|
var getterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyGetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(getterOriginal, prefix: new HarmonyMethod(getterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(getterOriginal, prefix: new HarmonyMethod(getterPatch));
|
||||||
|
|
||||||
@@ -283,11 +283,11 @@ public static class ModdedOptionsManager
|
|||||||
{
|
{
|
||||||
var listIndex = listType.GetProperty("Item")!;
|
var listIndex = listType.GetProperty("Item")!;
|
||||||
|
|
||||||
var listSetterOriginal = listIndex.GetSetMethod();
|
var listSetterOriginal = listIndex.GetSetMethod(true);
|
||||||
var listSetterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyListSetterPatch));
|
var listSetterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyListSetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(listSetterOriginal, postfix: new HarmonyMethod(listSetterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(listSetterOriginal, postfix: new HarmonyMethod(listSetterPatch));
|
||||||
|
|
||||||
var listGetterOriginal = listIndex.GetGetMethod();
|
var listGetterOriginal = listIndex.GetGetMethod(true);
|
||||||
var listGetterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyListGetterPatch));
|
var listGetterPatch = typeof(ModdedOptionsManager).GetMethod(nameof(PropertyListGetterPatch));
|
||||||
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(listGetterOriginal, prefix: new HarmonyMethod(listGetterPatch));
|
PluginSingleton<MiraApiPlugin>.Instance.Harmony.Patch(listGetterOriginal, prefix: new HarmonyMethod(listGetterPatch));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user