aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs (renamed from OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngineInterface.cs)4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs100
3 files changed, 111 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 42d8c27..08722a0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1012,5 +1012,14 @@ namespace OpenSim.Region.Environment.Scenes
1012 return result; 1012 return result;
1013 } 1013 }
1014 #endregion 1014 #endregion
1015
1016 #region Script Engine
1017 private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>();
1018 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine)
1019 {
1020 ScriptEngines.Add(ScriptEngine);
1021 ScriptEngine.InitializeEngine(this);
1022 }
1023 #endregion
1015 } 1024 }
1016} 1025}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
index bc735c9..3c3b5a7 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
@@ -30,9 +30,9 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32//TODO: WHERE TO PLACE THIS? 32//TODO: WHERE TO PLACE THIS?
33namespace OpenSim.Region.ScriptEngine.DotNetEngine 33namespace OpenSim.Region.Environment.Scenes.Scripting
34{ 34{
35 interface ScriptEngineInterface 35 public interface ScriptEngineInterface
36 { 36 {
37 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld); 37 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld);
38 void Shutdown(); 38 void Shutdown();
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
new file mode 100644
index 0000000..2f0551c
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
@@ -0,0 +1,100 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Reflection;
33
34namespace OpenSim.Region.Environment.Scenes.Scripting
35{
36 public class ScriptEngineLoader
37 {
38 public ScriptEngineLoader()
39 {
40 }
41
42 public ScriptEngineInterface LoadScriptEngine(string EngineName)
43 {
44 return LoadAndInitAssembly(@"ScriptEngines\OpenSim.Region.ScriptEngine." + EngineName + ".dll",
45 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
46 }
47
48 /// <summary>
49 /// Does actual loading and initialization of script Assembly
50 /// </summary>
51 /// <param name="FreeAppDomain">AppDomain to load script into</param>
52 /// <param name="FileName">FileName of script assembly (.dll)</param>
53 /// <returns></returns>
54 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
55 {
56 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
57 // Load .Net Assembly (.dll)
58 // Initialize and return it
59
60 // TODO: Add error handling
61
62 Assembly a;
63 //try
64 //{
65
66
67 // Load to default appdomain (temporary)
68 a = Assembly.LoadFrom(FileName);
69 // Load to specified appdomain
70 // TODO: Insert security
71 //a = FreeAppDomain.Load(FileName);
72 //}
73 //catch (Exception e)
74 //{
75 //}
76
77
78 //Console.WriteLine("Loading: " + FileName);
79 //foreach (Type _t in a.GetTypes())
80 //{
81 // Console.WriteLine("Type: " + _t.ToString());
82 //}
83
84 Type t;
85 //try
86 //{
87 t = a.GetType(NameSpace, true);
88 //}
89 //catch (Exception e)
90 //{
91 //}
92
93 return (ScriptEngineInterface)Activator.CreateInstance(t);
94
95
96 }
97
98
99 }
100}