From 055269805d88c5f3d347d3ba7d03db2182a78277 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Sun, 25 Mar 2012 22:59:06 -0700 Subject: Fix compile error in ScriptModuelComms and add some debugging into the modInvoke routines to simplify finding method registration issues. --- .../Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 7fc8759..c2ec5b4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -130,10 +130,18 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms public void RegisterScriptInvocation(object target, string meth) { - MethodInfo mi = target.GetType()..GetMethod(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) + { + m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); + return; + } + Type delegateType; - var typeArgs = mi.GetParameters() .Select(p => p.ParameterType) .ToList(); @@ -197,6 +205,8 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms return "modInvokeR"; else if (sid.ReturnType == typeof(object[])) return "modInvokeL"; + + m_log.WarnFormat("[MODULE COMMANDS] failed to find match for {0} with return type {1}",fname,sid.ReturnType.Name); } } -- cgit v1.1 From 7e0936e4b6ec0596390266a8435dea9c3f19f09c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 26 Mar 2012 14:19:55 +0100 Subject: Add a hust UUID to the script invocations --- .../ScriptModuleComms/ScriptModuleCommsModule.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 7fc8759..1e755ba 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms public void RegisterScriptInvocation(object target, string meth) { - MethodInfo mi = target.GetType()..GetMethod(meth, + MethodInfo mi = target.GetType().GetMethod(meth, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); Type delegateType; @@ -153,13 +153,13 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms lock (m_scriptInvocation) { ParameterInfo[] parameters = fcall.Method.GetParameters (); - if (parameters.Length == 0) // Must have one UUID param + if (parameters.Length < 2) // Must have two UUID params return; - // Hide the first parameter - Type[] parmTypes = new Type[parameters.Length - 1]; - for (int i = 1 ; i < parameters.Length ; i++) - parmTypes[i - 1] = parameters[i].ParameterType; + // Hide the first two parameters + Type[] parmTypes = new Type[parameters.Length - 2]; + for (int i = 2 ; i < parameters.Length ; i++) + parmTypes[i - 2] = parameters[i].ParameterType; m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); } } @@ -239,9 +239,10 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms return null; } - public object InvokeOperation(UUID scriptid, string fname, params object[] parms) + public object InvokeOperation(UUID hostid, UUID scriptid, string fname, params object[] parms) { List olist = new List(); + olist.Add(hostid); olist.Add(scriptid); foreach (object o in parms) olist.Add(o); -- cgit v1.1