From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Region/ScriptEngine/Common/Executor.cs | 88 ++++++++++++-------------- 1 file changed, 42 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/Executor.cs') diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs index a2148ea..c656e01 100644 --- a/OpenSim/Region/ScriptEngine/Common/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; -using System.Text; using System.Reflection; using System.Runtime.Remoting.Lifetime; @@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common { //Console.WriteLine("Executor: InitializeLifetimeService()"); // return null; - ILease lease = (ILease)base.InitializeLifetimeService(); + ILease lease = (ILease) base.InitializeLifetimeService(); if (lease.CurrentState == LeaseState.Initial) { @@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! //try //{ - if (m_Running == false) - { - // Script is inactive, do not execute! - return; - } + if (m_Running == false) + { + // Script is inactive, do not execute! + return; + } - string EventName = m_Script.State() + "_event_" + FunctionName; + string EventName = m_Script.State() + "_event_" + FunctionName; - //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); + //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); - //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); + //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); - if (Events.ContainsKey(EventName) == false) + if (Events.ContainsKey(EventName) == false) + { + // Not found, create + Type type = m_Script.GetType(); + try { - // Not found, create - Type type = m_Script.GetType(); - try - { - MethodInfo mi = type.GetMethod(EventName); - Events.Add(EventName, mi); - } - catch - { - // Event name not found, cache it as not found - Events.Add(EventName, null); - } + MethodInfo mi = type.GetMethod(EventName); + Events.Add(EventName, mi); } - - // Get event - MethodInfo ev = null; - Events.TryGetValue(EventName, out ev); - - if (ev == null) // No event by that name! + catch { - //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); - return; + // Event name not found, cache it as not found + Events.Add(EventName, null); } + } + + // Get event + MethodInfo ev = null; + Events.TryGetValue(EventName, out ev); + + if (ev == null) // No event by that name! + { + //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); + return; + } - // Found - //try - //{ - // Invoke it - ev.Invoke(m_Script, args); + // Found + //try + //{ + // Invoke it + ev.Invoke(m_Script, args); - //} - //catch (Exception e) - //{ - // // TODO: Send to correct place - // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); - //} + //} + //catch (Exception e) + //{ + // // TODO: Send to correct place + // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); + //} //} @@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common { m_Running = false; } - - } - -} +} \ No newline at end of file -- cgit v1.1