From a33c20c823db8b2f3afd03bfb17e594a9bd2e645 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 2 Jan 2019 13:18:52 +0100 Subject: [PATCH] ResolveMethodWithArg reuses the string version --- Mirror/Weaver/Resolvers.cs | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/Mirror/Weaver/Resolvers.cs b/Mirror/Weaver/Resolvers.cs index dca29d48d..f1d0ed098 100644 --- a/Mirror/Weaver/Resolvers.cs +++ b/Mirror/Weaver/Resolvers.cs @@ -58,26 +58,6 @@ public static MethodReference ResolveMethodInParents(TypeReference tr, AssemblyD return ResolveMethodInParents(tr.Resolve().BaseType, scriptDef, name); } - public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDefinition scriptDef, string name, TypeReference argType) - { - foreach (MethodDefinition methodRef in tr.Resolve().Methods) - { - if (methodRef.Name == name) - { - if (methodRef.Parameters.Count == 1) - { - if (methodRef.Parameters[0].ParameterType.FullName == argType.FullName) - { - return scriptDef.MainModule.ImportReference(methodRef); - } - } - } - } - Log.Error("ResolveMethodWithArg failed " + tr.Name + "::" + name + " " + argType); - Weaver.fail = true; - return null; - } - // System.Byte[] arguments need a version with a string public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDefinition scriptDef, string name, string argTypeFullName) { @@ -98,5 +78,11 @@ public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDef Weaver.fail = true; return null; } + + // reuse ResolveMethodWithArg string version + public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDefinition scriptDef, string name, TypeReference argType) + { + return ResolveMethodWithArg(tr, scriptDef, name, argType.FullName); + } } } \ No newline at end of file