HarmonyX
HarmonyX copied to clipboard
Shortcut for patching all method overloads?
Is your feature request related to a problem? Please describe.
Patching all method overloads is relatively verbose now, requiring manual patching which adds about 10 lines of code per patch.
(TargetMethods() requires extra classes; while Harmony.Patch() requires extra bookkeeping. So it becomes about 10 lines of code.)
Describe the solution you'd like If it is available in Attribute, it would be 0 line of code per patch and cleaner. IMHO Attribute way is cleaner because:
- TargetMethods()'s requirement of extra classes make it verbose (and does not cope with HarmonyPatch.CreateAndPatchAll);
- Harmony.Patch() separates hook target from hook implementation.
Describe alternatives you've considered
Either [HarmonyPatch(Type, string, [new-enum-overload-all])]
,
or [HarmonyPatch(Type{target-class}, [new-enum]{custom-filter-indicator}, Type{custom-filter}, ... {args forward to custom filter}])]
,
or [HarmonyPatch(Type{target-class}, [new-enum]{custom-filter-indicator}), TargetMethods(Type{custom-filter}, ... {args forward to custom filter}])]
.
Good idea. It could be added to the method type enum since this is only ever applicable to methods.