diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs new file mode 100644 index 0000000..834fac3 --- /dev/null +++ b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | using log4net; | ||
5 | using Nini.Config; | ||
6 | using OpenSim.Region.Environment.Scenes; | ||
7 | using OpenSim.Region.ScriptEngine.Shared; | ||
8 | using OpenSim.ScriptEngine.Shared; | ||
9 | using EventParams=OpenSim.ScriptEngine.Shared.EventParams; | ||
10 | |||
11 | namespace OpenSim.ScriptEngine.Shared | ||
12 | { | ||
13 | public struct RegionInfoStructure | ||
14 | { | ||
15 | public Scene Scene; | ||
16 | public IConfigSource ConfigSource; | ||
17 | |||
18 | public IScriptLoader ScriptLoader; | ||
19 | public Dictionary<string, IScriptEventProvider> EventProviders; | ||
20 | public Dictionary<string, IScriptExecutor> Executors; | ||
21 | public Dictionary<string, IScriptCompiler> Compilers; | ||
22 | public Dictionary<string, IScriptScheduler> Schedulers; | ||
23 | public Dictionary<string, IScriptCommandProvider> CommandProviders; | ||
24 | public ILog Logger; | ||
25 | |||
26 | public void Executors_Execute(EventParams p) | ||
27 | { | ||
28 | // Execute a command on all executors | ||
29 | lock (Executors) | ||
30 | { | ||
31 | foreach (IScriptExecutor exec in Executors.Values) | ||
32 | { | ||
33 | exec.ExecuteCommand(p); | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | public void Executors_Execute(ScriptStructure scriptContainer, EventParams p) | ||
38 | { | ||
39 | // Execute a command on all executors | ||
40 | lock (Executors) | ||
41 | { | ||
42 | foreach (IScriptExecutor exec in Executors.Values) | ||
43 | { | ||
44 | exec.ExecuteCommand(ref scriptContainer, p); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | public IScriptCompiler FindCompiler(ScriptMetaData scriptMetaData) | ||
50 | { | ||
51 | string compiler = "Compiler_LSL"; | ||
52 | if (scriptMetaData.ContainsKey("Compiler")) | ||
53 | compiler = scriptMetaData["Compiler"]; | ||
54 | |||
55 | lock (Compilers) | ||
56 | { | ||
57 | if (!Compilers.ContainsKey(compiler)) | ||
58 | throw new Exception("Requested script compiler \"" + compiler + "\" does not exist."); | ||
59 | |||
60 | return Compilers[compiler]; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public IScriptScheduler FindScheduler(ScriptMetaData scriptMetaData) | ||
65 | { | ||
66 | string scheduler = "Scheduler"; | ||
67 | if (scriptMetaData.ContainsKey("Scheduler")) | ||
68 | scheduler = scriptMetaData["Scheduler"]; | ||
69 | |||
70 | lock (Schedulers) | ||
71 | { | ||
72 | if (!Schedulers.ContainsKey(scheduler)) | ||
73 | throw new Exception("Requested script scheduler \"" + scheduler + "\" does not exist."); | ||
74 | |||
75 | return Schedulers[scheduler]; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | //public Assembly[] GetCommandProviderAssemblies() | ||
80 | //{ | ||
81 | // lock (CommandProviders) | ||
82 | // { | ||
83 | // Assembly[] ass = new Assembly[CommandProviders.Count]; | ||
84 | // int i = 0; | ||
85 | // foreach (string key in CommandProviders.Keys) | ||
86 | // { | ||
87 | // ass[i] = CommandProviders[key].GetType().Assembly; | ||
88 | // i++; | ||
89 | // } | ||
90 | // return ass; | ||
91 | // } | ||
92 | //} | ||
93 | } | ||
94 | } \ No newline at end of file | ||