diff options
author | Melanie | 2012-03-25 19:52:38 +0100 |
---|---|---|
committer | Melanie | 2012-03-25 19:52:38 +0100 |
commit | cb44808504e48125d630823880ee8e710afcd9ea (patch) | |
tree | 449a991ba060770b230244332015d0b6c7b41cef | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-cb44808504e48125d630823880ee8e710afcd9ea.zip opensim-SC-cb44808504e48125d630823880ee8e710afcd9ea.tar.gz opensim-SC-cb44808504e48125d630823880ee8e710afcd9ea.tar.bz2 opensim-SC-cb44808504e48125d630823880ee8e710afcd9ea.tar.xz |
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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 20 |
2 files changed, 20 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index bb4c788..8bfbbf8 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs | |||
@@ -46,7 +46,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
46 | /// </summary> | 46 | /// </summary> |
47 | event ScriptCommand OnScriptCommand; | 47 | event ScriptCommand OnScriptCommand; |
48 | 48 | ||
49 | void RegisterScriptInvocation(string name, ScriptInvocation fn, Type[] csig, Type rsig); | 49 | void RegisterScriptInvocation(ScriptInvocation fn); |
50 | ScriptInvocation[] GetScriptInvocationList(); | ||
50 | 51 | ||
51 | ScriptInvocation LookupScriptInvocation(string fname); | 52 | ScriptInvocation LookupScriptInvocation(string fname); |
52 | string LookupModInvocation(string fname); | 53 | string LookupModInvocation(string fname); |
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 | |||
126 | m_scriptModule.PostScriptEvent(script, "link_message", args); | 126 | m_scriptModule.PostScriptEvent(script, "link_message", args); |
127 | } | 127 | } |
128 | 128 | ||
129 | public void RegisterScriptInvocation(string fname, ScriptInvocation fcall, Type[] csig, Type rsig) | 129 | public void RegisterScriptInvocation(ScriptInvocation fcall) |
130 | { | 130 | { |
131 | lock (m_scriptInvocation) | 131 | lock (m_scriptInvocation) |
132 | { | 132 | { |
133 | m_scriptInvocation[fname] = new ScriptInvocationData(fname,fcall,csig,rsig); | 133 | ParameterInfo[] parameters = fcall.Method.GetParameters (); |
134 | Type[] parmTypes = new Type[parameters.Length]; | ||
135 | for (int i = 0 ; i < parameters.Length ; i++) | ||
136 | parmTypes[i] = parameters[i].ParameterType; | ||
137 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); | ||
134 | } | 138 | } |
135 | } | 139 | } |
136 | 140 | ||
141 | public ScriptInvocation[] GetScriptInvocationList() | ||
142 | { | ||
143 | List<ScriptInvocation> ret = new List<ScriptInvocation>(); | ||
144 | |||
145 | lock (m_scriptInvocation) | ||
146 | { | ||
147 | foreach (ScriptInvocationData d in m_scriptInvocation.Values) | ||
148 | ret.Add(d.ScriptInvocationFn); | ||
149 | } | ||
150 | return ret.ToArray(); | ||
151 | } | ||
152 | |||
137 | public string LookupModInvocation(string fname) | 153 | public string LookupModInvocation(string fname) |
138 | { | 154 | { |
139 | lock (m_scriptInvocation) | 155 | lock (m_scriptInvocation) |