diff --git a/Source/Client/Util/MpMethodUtil.cs b/Source/Client/Util/MpMethodUtil.cs index 9d159bb4..a353ff00 100644 --- a/Source/Client/Util/MpMethodUtil.cs +++ b/Source/Client/Util/MpMethodUtil.cs @@ -63,10 +63,10 @@ public static MethodInfo GetLocalFunc(Type parentType, string parentMethod = nul var displayClassPrefix = $"{DisplayClassPrefix}{parentId}_"; // Example: g__Start| - var localFuncPrefix = $"<{parentMethod}>{LocalFunctionInfix}{localFunc}|"; + var localFuncPrefix = $"<{parent.Name}>{LocalFunctionInfix}{localFunc}|"; // Example: g__Start|10 - var localFuncPrefixWithId = $"<{parentMethod}>{LocalFunctionInfix}{localFunc}|{parentId}"; + var localFuncPrefixWithId = $"<{parent.Name}>{LocalFunctionInfix}{localFunc}|{parentId}"; var candidates = parentType.GetNestedTypes(AccessTools.all). Where(t => t.Name.StartsWith(displayClassPrefix)). @@ -142,12 +142,12 @@ public static MethodBase GetMethod(Type type, string methodName, MethodType meth case MethodType.Getter: if (methodName == null) - return null; + return AccessTools.DeclaredIndexer(type, args).GetGetMethod(true); return AccessTools.DeclaredProperty(type, methodName).GetGetMethod(true); case MethodType.Setter: if (methodName == null) - return null; + return AccessTools.DeclaredIndexer(type, args).GetSetMethod(true); return AccessTools.DeclaredProperty(type, methodName).GetSetMethod(true); case MethodType.Constructor: @@ -162,6 +162,11 @@ public static MethodBase GetMethod(Type type, string methodName, MethodType meth if (methodName == null) return null; return AccessTools.EnumeratorMoveNext(AccessTools.DeclaredMethod(type, methodName, args)); + + case MethodType.Async: + if (methodName == null) + return null; + return AccessTools.AsyncMoveNext(AccessTools.DeclaredMethod(type, methodName, args)); } return null;