From cb44808504e48125d630823880ee8e710afcd9ea Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 25 Mar 2012 19:52:38 +0100 Subject: Simplify the module invocation registration. The types and method name can be pulled fromt he delegate so we don't need to pass them explicitly --- .../ScriptModuleComms/ScriptModuleCommsModule.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 0661c65..8e8a0b6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -126,14 +126,30 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms m_scriptModule.PostScriptEvent(script, "link_message", args); } - public void RegisterScriptInvocation(string fname, ScriptInvocation fcall, Type[] csig, Type rsig) + public void RegisterScriptInvocation(ScriptInvocation fcall) { lock (m_scriptInvocation) { - m_scriptInvocation[fname] = new ScriptInvocationData(fname,fcall,csig,rsig); + ParameterInfo[] parameters = fcall.Method.GetParameters (); + Type[] parmTypes = new Type[parameters.Length]; + for (int i = 0 ; i < parameters.Length ; i++) + parmTypes[i] = parameters[i].ParameterType; + m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); } } + public ScriptInvocation[] GetScriptInvocationList() + { + List ret = new List(); + + lock (m_scriptInvocation) + { + foreach (ScriptInvocationData d in m_scriptInvocation.Values) + ret.Add(d.ScriptInvocationFn); + } + return ret.ToArray(); + } + public string LookupModInvocation(string fname) { lock (m_scriptInvocation) -- cgit v1.1