aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/Executor.cs
diff options
context:
space:
mode:
authorTedd Hansen2007-08-18 23:24:38 +0000
committerTedd Hansen2007-08-18 23:24:38 +0000
commit37446b0392ba423894952f81aa0f938d2bd2de22 (patch)
tree674be11acb7037c8d98fb6de34bd12e547a6c175 /OpenSim/Region/ScriptEngine/Common/Executor.cs
parentstarting to add bits and pieces to physics prims that we will eventually need... (diff)
downloadopensim-SC-37446b0392ba423894952f81aa0f938d2bd2de22.zip
opensim-SC-37446b0392ba423894952f81aa0f938d2bd2de22.tar.gz
opensim-SC-37446b0392ba423894952f81aa0f938d2bd2de22.tar.bz2
opensim-SC-37446b0392ba423894952f81aa0f938d2bd2de22.tar.xz
Moved in-AppDomain event execution from Script to OpenSim.Region.ScriptEngine.Executor. Script no longer responsible for handling event calls to itself (and we can create reference cache in Executor).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/Executor.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Executor.cs48
1 files changed, 47 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs
index 2ae6a60..ca6459b 100644
--- a/OpenSim/Region/ScriptEngine/Common/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs
@@ -1,10 +1,56 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Reflection;
4 5
5namespace OpenSim.Region.ScriptEngine.Common 6namespace OpenSim.Region.ScriptEngine.Common
6{ 7{
7 class Executor 8 public class Executor: MarshalByRefObject
8 { 9 {
10 /* TODO:
11 *
12 * Needs to be common for all AppDomains - share memory too?
13 * Needs to have an instance in each AppDomain, and some way of referring it.
14 * Need to know what AppDomain a script is in so we know where to find our instance.
15 *
16 */
17
18 private IScript m_Script;
19
20 public Executor(IScript Script)
21 {
22 m_Script = Script;
23 }
24 public void ExecuteEvent(string FunctionName, object[] args)
25 {
26 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
27 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
28
29 //foreach (MemberInfo mi in this.GetType().GetMembers())
30 //{
31 //if (mi.ToString().ToLower().Contains("default"))
32 //{
33 // Console.WriteLine("Member found: " + mi.ToString());
34 //}
35 //}
36
37 Type type = m_Script.GetType();
38
39 Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + m_Script.State() + "_event_" + FunctionName + "\"");
40
41 try
42 {
43 type.InvokeMember(m_Script.State() + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, m_Script, args);
44 }
45 catch (Exception e)
46 {
47 // TODO: Send to correct place
48 Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
49 }
50
51
52 }
53
54
9 } 55 }
10} 56}