Add some more overloads to allow registering overloaded methods and lists
of methods.0.7.4.1
parent
2fcdecf090
commit
ad865ab4fc
|
@ -47,6 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
event ScriptCommand OnScriptCommand;
|
||||
|
||||
void RegisterScriptInvocation(object target, string method);
|
||||
void RegisterScriptInvocation(object target, MethodInfo method);
|
||||
void RegisterScriptInvocation(object target, string[] methods);
|
||||
Delegate[] GetScriptInvocationList();
|
||||
|
||||
Delegate LookupScriptInvocation(string fname);
|
||||
|
|
|
@ -130,9 +130,6 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
|||
|
||||
public void RegisterScriptInvocation(object target, string meth)
|
||||
{
|
||||
m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}",meth,target.GetType().Name);
|
||||
|
||||
|
||||
MethodInfo mi = target.GetType().GetMethod(meth,
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (mi == null)
|
||||
|
@ -140,7 +137,20 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
|||
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RegisterScriptInvocation(target, mi);
|
||||
}
|
||||
|
||||
public void RegisterScriptInvocation(object target, string[] meth)
|
||||
{
|
||||
foreach (string m in meth)
|
||||
RegisterScriptInvocation(target, m);
|
||||
}
|
||||
|
||||
public void RegisterScriptInvocation(object target, MethodInfo mi)
|
||||
{
|
||||
m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name);
|
||||
|
||||
Type delegateType;
|
||||
var typeArgs = mi.GetParameters()
|
||||
.Select(p => p.ParameterType)
|
||||
|
|
Loading…
Reference in New Issue