aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs117
1 files changed, 0 insertions, 117 deletions
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
deleted file mode 100644
index 4d8c559..0000000
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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
28using System;
29using System.IO;
30using System.Reflection;
31using log4net;
32using OpenSim.Region.ScriptEngine.Common;
33
34namespace OpenSim.Grid.ScriptServer.ScriptServer
35{
36 internal class ScriptEngineLoader
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 public ScriptServerInterfaces.ScriptEngine LoadScriptEngine(string EngineName)
41 {
42 ScriptServerInterfaces.ScriptEngine ret = null;
43 try
44 {
45 ret =
46 LoadAndInitAssembly(
47 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
48 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
49 }
50 catch (Exception e)
51 {
52 m_log.Error("[ScriptEngine]: " +
53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
54 e.StackTrace.ToString());
55 }
56 return ret;
57 }
58
59 /// <summary>
60 /// Does actual loading and initialization of script Assembly
61 /// </summary>
62 /// <returns></returns>
63 private ScriptServerInterfaces.ScriptEngine LoadAndInitAssembly(string FileName, string NameSpace)
64 {
65 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
66 // Load .Net Assembly (.dll)
67 // Initialize and return it
68
69 // TODO: Add error handling
70
71 Assembly a;
72 //try
73 //{
74
75
76 // Load to default appdomain (temporary)
77 a = Assembly.LoadFrom(FileName);
78 // Load to specified appdomain
79 // TODO: Insert security
80 //a = FreeAppDomain.Load(FileName);
81 //}
82 //catch (Exception e)
83 //{
84 // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString());
85 //}
86
87
88 //Console.WriteLine("Loading: " + FileName);
89 //foreach (Type _t in a.GetTypes())
90 //{
91 // Console.WriteLine("Type: " + _t.ToString());
92 //}
93
94 Type t;
95 //try
96 //{
97 t = a.GetType(NameSpace, true);
98 //}
99 //catch (Exception e)
100 //{
101 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
102 //}
103
104 ScriptServerInterfaces.ScriptEngine ret;
105 //try
106 //{
107 ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t);
108 //}
109 //catch (Exception e)
110 //{
111 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
112 //}
113
114 return ret;
115 }
116 }
117}