adding support for static method script invocations

This commit is contained in:
SignpostMarv
2012-08-31 13:50:46 +01:00
committed by Melanie
parent b625579780
commit 794c5f5a6d
2 changed files with 24 additions and 2 deletions

View File

@@ -181,7 +181,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
}
Delegate fcall;
if (!(target is Type))
fcall = Delegate.CreateDelegate(delegateType, target, mi);
else
fcall = Delegate.CreateDelegate(delegateType, (Type)target, mi.Name);
lock (m_scriptInvocation)
{
@@ -196,6 +199,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
}
}
public void RegisterScriptInvocation(Type target, string[] methods)
{
foreach (string method in methods)
{
MethodInfo mi = GetMethodInfoFromType(target, method, false);
if (mi == null)
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", method);
else
RegisterScriptInvocation(target, mi);
}
}
public Delegate[] GetScriptInvocationList()
{