From e6f43023b6fe682971b78175fbb694c18848eff0 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 31 Aug 2012 13:09:15 +0100 Subject: adding support for finding static methods --- .../Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 50d04cd..19130bd 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -130,17 +130,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms m_scriptModule.PostScriptEvent(script, "link_message", args); } - private static MethodInfo GetMethodInfoFromType(Type target, string meth) + private static MethodInfo GetMethodInfoFromType(Type target, string meth, bool searchInstanceMethods) { BindingFlags getMethodFlags = - BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; + BindingFlags.NonPublic | BindingFlags.Public; + + if (searchInstanceMethods) + getMethodFlags |= BindingFlags.Instance; + else + getMethodFlags |= BindingFlags.Static; + return target.GetMethod(meth, getMethodFlags); } public void RegisterScriptInvocation(object target, string meth) { - MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth); + MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true); if (mi == null) { m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); -- cgit v1.1