mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
ResolveMethodWithArg reuses the string version
This commit is contained in:
parent
fb124269f9
commit
a33c20c823
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user