aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
diff options
context:
space:
mode:
authorlbsa712007-09-19 00:30:55 +0000
committerlbsa712007-09-19 00:30:55 +0000
commit8f0b03597b0bc8ea6873af9a55495407fae1ec56 (patch)
treef9f4de38379aebf2223ad4cb10a3d9ebcfa52a4f /OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
parent* Moved SendLogoutPacket back to IClientAPI. (diff)
downloadopensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.zip
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.gz
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.bz2
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.xz
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs43
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*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.ExtensionsScriptModule.CSharp;
33using OpenSim.Region.ExtensionsScriptModule.CSharp; 33using OpenSim.Region.ExtensionsScriptModule.JScript;
34using OpenSim.Region.ExtensionsScriptModule.JScript; 34using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
35using OpenSim.Region.ExtensionsScriptModule.JVMEngine; 35
36
37namespace OpenSim.Region.ExtensionsScriptModule 36namespace 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