diff options
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index ac5ac89..61541e8 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -25,22 +25,21 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment; | 30 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
33 | using OpenSim.Region.ExtensionsScriptModule.CSharp; | 33 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
34 | using OpenSim.Region.ExtensionsScriptModule.JScript; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; | 35 | |
36 | |||
37 | namespace OpenSim.Region.ExtensionsScriptModule | 36 | namespace OpenSim.Region.ExtensionsScriptModule |
38 | { | 37 | { |
39 | public class ScriptManager : IRegionModule | 38 | public class ScriptManager : IRegionModule, IExtensionScriptModule |
40 | { | 39 | { |
41 | List<IScript> scripts = new List<IScript>(); | 40 | readonly List<IScript> scripts = new List<IScript>(); |
42 | Scene m_scene; | 41 | Scene m_scene; |
43 | Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | 42 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); |
44 | 43 | ||
45 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) | 44 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) |
46 | { | 45 | { |
@@ -65,15 +64,17 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
65 | 64 | ||
66 | JavaEngine javaCompiler = new JavaEngine(); | 65 | JavaEngine javaCompiler = new JavaEngine(); |
67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); | 66 | compilers.Add(javaCompiler.FileExt(), javaCompiler); |
68 | } | 67 | } |
68 | |||
69 | public delegate TResult ModuleAPIMethod1<TResult, TParam0>(TParam0 param0); | ||
70 | public delegate TResult ModuleAPIMethod2<TResult, TParam0, TParam1>(TParam0 param0, TParam1 param1); | ||
69 | 71 | ||
70 | public void Initialise(Scene scene) | 72 | public void Initialise(Scene scene) |
71 | { | 73 | { |
72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); | 74 | System.Console.WriteLine("Initialising Extensions Scripting Module"); |
73 | m_scene = scene; | 75 | m_scene = scene; |
74 | 76 | ||
75 | m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); | 77 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); |
76 | m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript)); | ||
77 | } | 78 | } |
78 | 79 | ||
79 | public void PostInitialise() | 80 | public void PostInitialise() |
@@ -133,6 +134,12 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
133 | 134 | ||
134 | return true; | 135 | return true; |
135 | } | 136 | } |
137 | } | ||
138 | |||
139 | public interface IExtensionScriptModule | ||
140 | { | ||
141 | bool Compile(string filename); | ||
142 | bool AddPreCompiledScript(IScript script); | ||
136 | } | 143 | } |
137 | 144 | ||
138 | interface IScriptCompiler | 145 | interface IScriptCompiler |