diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/ScriptEngine/Common/Executor.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/Executor.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/Executor.cs | 88 |
1 files changed, 42 insertions, 46 deletions
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 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
34 | 33 | ||
@@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
53 | { | 52 | { |
54 | //Console.WriteLine("Executor: InitializeLifetimeService()"); | 53 | //Console.WriteLine("Executor: InitializeLifetimeService()"); |
55 | // return null; | 54 | // return null; |
56 | ILease lease = (ILease)base.InitializeLifetimeService(); | 55 | ILease lease = (ILease) base.InitializeLifetimeService(); |
57 | 56 | ||
58 | if (lease.CurrentState == LeaseState.Initial) | 57 | if (lease.CurrentState == LeaseState.Initial) |
59 | { | 58 | { |
@@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
75 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 74 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
76 | //try | 75 | //try |
77 | //{ | 76 | //{ |
78 | if (m_Running == false) | 77 | if (m_Running == false) |
79 | { | 78 | { |
80 | // Script is inactive, do not execute! | 79 | // Script is inactive, do not execute! |
81 | return; | 80 | return; |
82 | } | 81 | } |
83 | 82 | ||
84 | string EventName = m_Script.State() + "_event_" + FunctionName; | 83 | string EventName = m_Script.State() + "_event_" + FunctionName; |
85 | 84 | ||
86 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); | 85 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); |
87 | 86 | ||
88 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); | 87 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); |
89 | 88 | ||
90 | if (Events.ContainsKey(EventName) == false) | 89 | if (Events.ContainsKey(EventName) == false) |
90 | { | ||
91 | // Not found, create | ||
92 | Type type = m_Script.GetType(); | ||
93 | try | ||
91 | { | 94 | { |
92 | // Not found, create | 95 | MethodInfo mi = type.GetMethod(EventName); |
93 | Type type = m_Script.GetType(); | 96 | Events.Add(EventName, mi); |
94 | try | ||
95 | { | ||
96 | MethodInfo mi = type.GetMethod(EventName); | ||
97 | Events.Add(EventName, mi); | ||
98 | } | ||
99 | catch | ||
100 | { | ||
101 | // Event name not found, cache it as not found | ||
102 | Events.Add(EventName, null); | ||
103 | } | ||
104 | } | 97 | } |
105 | 98 | catch | |
106 | // Get event | ||
107 | MethodInfo ev = null; | ||
108 | Events.TryGetValue(EventName, out ev); | ||
109 | |||
110 | if (ev == null) // No event by that name! | ||
111 | { | 99 | { |
112 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | 100 | // Event name not found, cache it as not found |
113 | return; | 101 | Events.Add(EventName, null); |
114 | } | 102 | } |
103 | } | ||
104 | |||
105 | // Get event | ||
106 | MethodInfo ev = null; | ||
107 | Events.TryGetValue(EventName, out ev); | ||
108 | |||
109 | if (ev == null) // No event by that name! | ||
110 | { | ||
111 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | ||
112 | return; | ||
113 | } | ||
115 | 114 | ||
116 | // Found | 115 | // Found |
117 | //try | 116 | //try |
118 | //{ | 117 | //{ |
119 | // Invoke it | 118 | // Invoke it |
120 | ev.Invoke(m_Script, args); | 119 | ev.Invoke(m_Script, args); |
121 | 120 | ||
122 | //} | 121 | //} |
123 | //catch (Exception e) | 122 | //catch (Exception e) |
124 | //{ | 123 | //{ |
125 | // // TODO: Send to correct place | 124 | // // TODO: Send to correct place |
126 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); | 125 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); |
127 | //} | 126 | //} |
128 | 127 | ||
129 | 128 | ||
130 | //} | 129 | //} |
@@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
136 | { | 135 | { |
137 | m_Running = false; | 136 | m_Running = false; |
138 | } | 137 | } |
139 | |||
140 | |||
141 | } | 138 | } |
142 | 139 | } \ No newline at end of file | |
143 | } | ||