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;
|
event ScriptCommand OnScriptCommand;
|
||||||
|
|
||||||
void RegisterScriptInvocation(object target, string method);
|
void RegisterScriptInvocation(object target, string method);
|
||||||
|
void RegisterScriptInvocation(object target, MethodInfo method);
|
||||||
|
void RegisterScriptInvocation(object target, string[] methods);
|
||||||
Delegate[] GetScriptInvocationList();
|
Delegate[] GetScriptInvocationList();
|
||||||
|
|
||||||
Delegate LookupScriptInvocation(string fname);
|
Delegate LookupScriptInvocation(string fname);
|
||||||
|
|
|
@ -130,9 +130,6 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
||||||
|
|
||||||
public void RegisterScriptInvocation(object target, string meth)
|
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,
|
MethodInfo mi = target.GetType().GetMethod(meth,
|
||||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||||
if (mi == null)
|
if (mi == null)
|
||||||
|
@ -141,6 +138,19 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
||||||
return;
|
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;
|
Type delegateType;
|
||||||
var typeArgs = mi.GetParameters()
|
var typeArgs = mi.GetParameters()
|
||||||
.Select(p => p.ParameterType)
|
.Select(p => p.ParameterType)
|
||||||
|
|
Loading…
Reference in New Issue