aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/Executor.cs
diff options
context:
space:
mode:
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}