aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-27 13:31:04 -0700
committerJohn Hurliman2009-10-27 13:31:04 -0700
commit2525810e2a1b23f9c5b17b3d075e02c0c6255e2c (patch)
treef4312229b82d5edf8477920a97e7e79c40379473 /OpenSim/ScriptEngine
parentLowering the position tolerance of terse updates for ScenePresences to mitiga... (diff)
downloadopensim-SC-2525810e2a1b23f9c5b17b3d075e02c0c6255e2c.zip
opensim-SC-2525810e2a1b23f9c5b17b3d075e02c0c6255e2c.tar.gz
opensim-SC-2525810e2a1b23f9c5b17b3d075e02c0c6255e2c.tar.bz2
opensim-SC-2525810e2a1b23f9c5b17b3d075e02c0c6255e2c.tar.xz
Removed the DotNetEngine scripting engine. You will need to create a fresh checkout or clean out all *DotNet*.dll assemblies from the bin/ directory to run OpenSim moving forward
Diffstat (limited to 'OpenSim/ScriptEngine')
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs40
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs56
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs44
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs187
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs70
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs56
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs57
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs56
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs55
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs44
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs54
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs121
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs240
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs49
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs55
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs216
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs203
-rw-r--r--OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs287
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs196
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs95
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs63
26 files changed, 0 insertions, 2559 deletions
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs
deleted file mode 100644
index 0b7c894..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Commands_LSL.cs
+++ /dev/null
@@ -1,40 +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 OpenSimulator 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.Collections.Generic;
30using System.Text;
31using OpenSim.ScriptEngine.Shared;
32
33namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL
34{
35 public class Commands_LSL : IScriptEngineComponent
36 {
37
38
39 }
40}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs
deleted file mode 100644
index fdbc699..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/LSL_BaseClass.cs
+++ /dev/null
@@ -1,56 +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 OpenSimulator 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.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using OpenSim.ScriptEngine.Shared;
34
35namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL
36{
37 public class Script : IScriptCommandProvider
38 {
39 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
41 public void llSay(int channelID, string text)
42 {
43 m_log.InfoFormat("[{0}] llSay({1}, \"{2}\")", "(Commands_LSL)OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL.Script", channelID, text);
44 }
45
46 public void ExecuteCommand(string functionName, params object[] args)
47 {
48
49 }
50
51 public string Name
52 {
53 get { return "SECS.DotNetEngine.Commands_LSL.Script"; }
54 }
55 }
56} \ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs
deleted file mode 100644
index fc67ec1..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_LSL/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_LSL")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs
deleted file mode 100644
index 86eab09..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Commands_OSSL.cs
+++ /dev/null
@@ -1,44 +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 OpenSimulator 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.Collections.Generic;
30using System.Text;
31using OpenSim.ScriptEngine.Shared;
32
33namespace OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL
34{
35 public class Commands_OSSL : IScriptEngineComponent
36 {
37 //private RegionInfoStructure CurrentRegion;
38 public void Initialize(RegionInfoStructure currentRegion)
39 {
40 //CurrentRegion = currentRegion;
41 }
42
43 }
44}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs
deleted file mode 100644
index c6b15cf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Commands_OSSL/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Commands_OSSL")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs
deleted file mode 100644
index 3d2d9d2..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs
+++ /dev/null
@@ -1,187 +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 OpenSimulator 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 */
27using System;
28using System.CodeDom.Compiler;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Text.RegularExpressions;
33using log4net;
34using OpenSim.ScriptEngine.Shared;
35using ScriptAssemblies;
36
37namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
38{
39 public abstract class CILCompiler
40 {
41 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 private string ScriptEnginesPath = "ScriptEngines";
43 private string Name { get { return "SECS.DotNetEngine.CILCompiler"; } }
44 private string m_scriptAssemblyName;
45 internal string ScriptAssemblyName { get { return m_scriptAssemblyName; } set { m_scriptAssemblyName = value; } }
46
47 // Default inherit
48 protected string ScriptInheritFrom = typeof(ScriptAssemblies.ScriptBase).Name;
49 private readonly System.Security.Cryptography.MD5CryptoServiceProvider MD5Sum = new System.Security.Cryptography.MD5CryptoServiceProvider();
50 protected CodeDomProvider CompileProvider;
51
52 //private string[] AppDomainAssemblies = new string[] { "OpenSim.Region.ScriptEngine.Shared.dll", "OpenSim.Region.ScriptEngine.Shared.Script.dll", "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll" };
53 private readonly string[] AppDomainAssemblies = new string[] {
54 Assembly.GetAssembly(typeof(Int32)).Location,
55 "OpenSim.ScriptEngine.Shared.dll",
56 "OpenSim.ScriptEngine.Shared.Script.dll",
57 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.Shared.dll")
58 };
59
60 public abstract string PreProcessScript(ref string script);
61
62 public CILCompiler()
63 {
64 }
65
66 private static readonly Regex FileNameFixer = new Regex(@"[^a-zA-Z0-9\.\-]", RegexOptions.Compiled | RegexOptions.Singleline);
67 public string Compile(ScriptMetaData data, ref string _script)
68 {
69 // Add "using", "inherit", default constructor, etc around script.
70 string script = PreProcessScript(ref _script);
71
72 // Get filename based on content
73 string md5Sum = System.Convert.ToBase64String(
74 MD5Sum.ComputeHash(
75 System.Text.Encoding.ASCII.GetBytes(script)
76 ));
77 // Unique name for this assembly
78 ScriptAssemblyName = "SECS_Script_" + FileNameFixer.Replace(md5Sum, "_");
79
80 string OutFile = Path.Combine(ScriptEnginesPath, ScriptAssemblyName + ".dll");
81
82 // Make sure target dir exist
83 if (!Directory.Exists(ScriptEnginesPath))
84 try { Directory.CreateDirectory(ScriptEnginesPath); }
85 catch { }
86
87 // Already exist? No point in recompiling
88 if (File.Exists(OutFile))
89 return OutFile;
90
91 //
92 // Dump source code
93 //
94 string dumpFile = OutFile + ".txt";
95 try
96 {
97 if (File.Exists(dumpFile))
98 File.Delete(dumpFile);
99 File.WriteAllText(dumpFile, script);
100 }
101 catch (Exception e)
102 {
103 m_log.DebugFormat("[{0}] Exception trying to dump script source code to file \"{1}\": {2}", Name, dumpFile, e.ToString());
104 }
105
106 //
107 // COMPILE
108 //
109
110 CompilerParameters parameters = new CompilerParameters();
111 parameters.IncludeDebugInformation = true;
112 //string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
113
114 foreach (string file in AppDomainAssemblies)
115 {
116 parameters.ReferencedAssemblies.Add(file);
117 m_log.DebugFormat("[{0}] Adding reference for compile: \"{1}\".", Name, file);
118 }
119 //lock (commandProvider)
120 //{
121 // foreach (string key in commandProvider.Keys)
122 // {
123 // IScriptCommandProvider cp = commandProvider[key];
124 // string
125 // file = cp.GetType().Assembly.Location;
126 // parameters.ReferencedAssemblies.Add(file);
127 // m_log.DebugFormat("[{0}] Loading command provider assembly \"{1}\" into AppDomain: \"{2}\".", Name,
128 // key, file);
129 // }
130 //}
131
132 parameters.GenerateExecutable = false;
133 parameters.OutputAssembly = OutFile;
134 parameters.IncludeDebugInformation = true;
135 //parameters.WarningLevel = 1; // Should be 4?
136 parameters.TreatWarningsAsErrors = false;
137
138 // Do compile
139 CompilerResults results = CompileProvider.CompileAssemblyFromSource(parameters, script);
140
141
142 //
143 // WARNINGS AND ERRORS
144 //
145 //TODO
146 int display = 5;
147 if (results.Errors.Count > 0)
148 {
149 string errtext = String.Empty;
150 foreach (CompilerError CompErr in results.Errors)
151 {
152 // Show 5 errors max
153 //
154 if (display <= 0)
155 break;
156 display--;
157
158 string severity = "Error";
159 if (CompErr.IsWarning)
160 severity = "Warning";
161
162 //TODO: Implement
163 KeyValuePair<int, int> lslPos = new KeyValuePair<int, int>();
164
165 //lslPos = "NOT IMPLEMENTED";// FindErrorPosition(CompErr.Line, CompErr.Column);
166
167 string text = CompErr.ErrorText;
168
169 // The Second Life viewer's script editor begins
170 // countingn lines and columns at 0, so we subtract 1.
171 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
172 lslPos.Key - 1, lslPos.Value - 1,
173 CompErr.ErrorNumber, text, severity);
174 }
175
176 if (!File.Exists(OutFile))
177 {
178 throw new Exception(errtext);
179 }
180 }
181
182 // TODO: Process errors
183 return OutFile;
184 }
185
186 }
187}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs
deleted file mode 100644
index a8599bf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs
+++ /dev/null
@@ -1,70 +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 OpenSimulator 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 */
27using System;
28using System.CodeDom.Compiler;
29using System.Collections.Generic;
30using System.Text;
31using Microsoft.CSharp;
32using OpenSim.ScriptEngine.Shared;
33
34namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
35{
36 public class Compiler_CS : CILCompiler, IScriptCompiler
37 {
38 private string[] ScriptUsing = new string[]
39 {
40 "System",
41 "OpenSim.ScriptEngine.Shared",
42 "OpenSim.Region.ScriptEngine.Shared",
43 "System.Collections.Generic"
44 };
45
46 public Compiler_CS()
47 {
48 CompileProvider = new CSharpCodeProvider();
49 }
50
51 public override string PreProcessScript(ref string script)
52 {
53 string s = "";
54 foreach (string u in ScriptUsing)
55 {
56 s += "using " + u + ";";
57 }
58
59 s += "\r\n"
60 + String.Empty + "namespace ScriptAssemblies { "
61 + String.Empty + "public class UserScript" + " : " + ScriptInheritFrom + " { \r\n" +
62 @"public Script() { } " +
63 script +
64 "} }\r\n";
65
66 return s;
67 }
68
69 }
70}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs
deleted file mode 100644
index 4361ae2..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs
+++ /dev/null
@@ -1,56 +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 OpenSimulator 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 */
27using System;
28using System.CodeDom.Compiler;
29using System.Collections.Generic;
30using System.Text;
31using Microsoft.JScript;
32using OpenSim.ScriptEngine.Shared;
33
34namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
35{
36 public class Compiler_JS : CILCompiler, IScriptCompiler
37 {
38
39 public Compiler_JS()
40 {
41 CompileProvider = new JScriptCodeProvider() as CodeDomProvider;
42 }
43
44 public override string PreProcessScript(ref string script)
45 {
46 return
47 "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
48 "package SecondLife {\r\n" +
49 "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
50 script +
51 "} }\r\n";
52
53 }
54
55 }
56}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs
deleted file mode 100644
index 496afc9..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs
+++ /dev/null
@@ -1,57 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL;
32using OpenSim.ScriptEngine.Shared;
33
34namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
35{
36 public class Compiler_LSL : IScriptCompiler
37 {
38
39
40 private readonly Compiler_CS m_Compiler_CS = new Compiler_CS();
41 private readonly LSL2CS m_LSL2CS = new LSL2CS();
42
43 public string Compile(ScriptMetaData scriptMetaData, ref string script)
44 {
45 // Convert script to CS
46 string scriptCS = m_LSL2CS.Convert(ref script);
47 // Use CS compiler to compile it
48 return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS);
49 }
50
51 public string PreProcessScript(ref string script)
52 {
53 // This is handled by our converter
54 return script;
55 }
56 }
57}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs
deleted file mode 100644
index 04597ba..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs
+++ /dev/null
@@ -1,56 +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 OpenSimulator 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 */
27using System;
28using System.CodeDom.Compiler;
29using System.Collections.Generic;
30using System.Text;
31using Microsoft.VisualBasic;
32using OpenSim.ScriptEngine.Shared;
33
34namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
35{
36 public class Compiler_VB : CILCompiler, IScriptCompiler
37 {
38
39 public Compiler_VB()
40 {
41 CompileProvider = new VBCodeProvider() as CodeDomProvider;
42 }
43
44 public override string PreProcessScript(ref string script)
45 {
46 return
47 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
48 String.Empty + "NameSpace SecondLife:" +
49 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " +
50 "\r\nPublic Sub New()\r\nEnd Sub: " +
51 script +
52 ":End Class :End Namespace\r\n";
53 }
54 }
55}
56
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs
deleted file mode 100644
index dce17ad..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs
+++ /dev/null
@@ -1,55 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP;
32using OpenSim.ScriptEngine.Shared;
33
34namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers
35{
36 public class Compiler_YP: IScriptCompiler
37 {
38
39 private readonly Compiler_CS m_Compiler_CS = new Compiler_CS();
40
41 public string Compile(ScriptMetaData scriptMetaData, ref string script)
42 {
43 // Convert script to CS
44 string scriptCS = YP2CS.Convert(ref script);
45 // Use CS compiler to compile it
46 return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS);
47 }
48
49 public string PreProcessScript(ref string script)
50 {
51 // This is handled by our converter
52 return script;
53 }
54 }
55}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs
deleted file mode 100644
index d4af1c7..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs
+++ /dev/null
@@ -1,44 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenSim.Region.ScriptEngine.Shared.CodeTools;
31
32namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL
33{
34 public class LSL2CS
35 {
36 private ICodeConverter Converter = new CSCodeGenerator();
37
38 public string Convert(ref string script)
39 {
40 //m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap;
41 return Converter.Convert(script);
42 }
43 }
44}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs
deleted file mode 100644
index dedc48e..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs
deleted file mode 100644
index 10b5715..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs
+++ /dev/null
@@ -1,54 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30
31namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP
32{
33 public class YP2CS
34 {
35 public static string Convert(ref string script)
36 {
37 return script;
38 }
39
40 public string PreProcessScript(ref string script)
41 {
42 return
43 "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
44 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
45 String.Empty + "namespace SecondLife { " +
46 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
47 //@"public Script() { } " +
48 @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " +
49 @"public Script() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " +
50 script +
51 "} }\r\n";
52 }
53 }
54}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
deleted file mode 100644
index 81dc62d..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/LSLEventProvider.cs
+++ /dev/null
@@ -1,121 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.ScriptEngine.Shared;
35using EventParams = OpenSim.ScriptEngine.Shared.EventParams;
36
37namespace OpenSim.ScriptEngine.Components.DotNetEngine.Events
38{
39 public class LSLEventProvider : IScriptEventProvider
40 {
41 public delegate void RezScriptDelegate(uint localID, UUID itemID, string script, int startParam, bool postOnRez,
42 string engine);
43 public event RezScriptDelegate RezScript;
44 public delegate void RemoveScriptDelegate(uint localID, UUID itemID);
45 public event RemoveScriptDelegate RemoveScript;
46 public delegate void ScriptChangedDelegate(uint localID, uint change);
47 public event ScriptChangedDelegate ScriptChanged;
48
49 private RegionInfoStructure CurrentRegion;
50 public void Initialize(RegionInfoStructure currentRegion)
51 {
52 CurrentRegion = currentRegion;
53 HookupEvents();
54 }
55
56 private void HookupEvents()
57 {
58 CurrentRegion.Scene.EventManager.OnObjectGrab += OnObjectGrab;
59 CurrentRegion.Scene.EventManager.OnRezScript += OnRezScript;
60 CurrentRegion.Scene.EventManager.OnRemoveScript += OnRemoveScript;
61 CurrentRegion.Scene.EventManager.OnScriptChangedEvent += OnScriptChangedEvent;
62
63
64 }
65
66 private void OnScriptChangedEvent(uint localID, uint change)
67 {
68 // Script is being changed, fire event
69 if (ScriptChanged != null)
70 ScriptChanged(localID, change);
71 }
72
73 private void OnRemoveScript(uint localID, UUID itemID)
74 {
75 // Script is being removed, fire event
76 if (RemoveScript != null)
77 RemoveScript(localID, itemID);
78 }
79
80 private void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
81 {
82 // New script being created, fire event
83 if (RezScript != null)
84 RezScript(localID, itemID, script, startParam, postOnRez, engine);
85 }
86
87 private void OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
88 {
89 // Add to queue for all scripts in ObjectID object
90 DetectParams[] det = new DetectParams[1];
91 det[0] = new DetectParams();
92 det[0].Key = remoteClient.AgentId;
93 //det[0].Populate(World);
94
95 if (originalID == 0)
96 {
97 SceneObjectPart part =
98 CurrentRegion.Scene.GetSceneObjectPart(localID);
99
100 if (part == null)
101 return;
102
103 det[0].LinkNum = part.LinkNum;
104 }
105 else
106 {
107 SceneObjectPart originalPart =
108 CurrentRegion.Scene.GetSceneObjectPart(originalID);
109 det[0].LinkNum = originalPart.LinkNum;
110 }
111 if (surfaceArgs != null)
112 {
113 det[0].SurfaceTouchArgs = surfaceArgs;
114 }
115 Shared.EventParams ep =
116 new Shared.EventParams(localID, "touch_start", new Object[] {new LSL_Types.LSLInteger(1)}, det);
117 CurrentRegion.Executors_Execute(ep);
118
119 }
120 }
121}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs
deleted file mode 100644
index 299304a..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Events/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs
deleted file mode 100644
index afa2300..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/BaseClassFactory.cs
+++ /dev/null
@@ -1,240 +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 OpenSimulator 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.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Reflection.Emit;
33using System.Text;
34using OpenSim.ScriptEngine.Shared;
35
36namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
37{
38 public class BaseClassFactory
39 {
40
41
42 public static void MakeBaseClass(ScriptStructure script)
43 {
44 string asmName = "ScriptAssemblies";
45 string ModuleID = asmName;
46 string ClassID = "Script";
47 string moveToDir = "ScriptEngines";
48 string asmFileName = ModuleID + "_" + ClassID + ".dll";
49 if (!Directory.Exists(moveToDir))
50 Directory.CreateDirectory(moveToDir);
51
52 ILGenerator ilgen;
53 AssemblyBuilder asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
54 new AssemblyName(asmName), AssemblyBuilderAccess.RunAndSave);
55
56 // The module builder
57 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule(ModuleID, asmFileName);
58
59 // The class builder
60 TypeBuilder classBuilder = modBuilder.DefineType(ClassID, TypeAttributes.Class | TypeAttributes.Public);
61
62 // The default constructor
63 //ConstructorBuilder ctorBuilder = classBuilder.DefineDefaultConstructor(MethodAttributes.Public);
64
65
66 Type[] paramsTypeArray = new Type[] {typeof (System.ParamArrayAttribute)};
67 Type[] executeFunctionTypeArray = new Type[] {typeof (string), typeof (System.ParamArrayAttribute)};
68 foreach (IScriptCommandProvider cp in script.RegionInfo.CommandProviders.Values)
69 {
70 Type t = cp.GetType();
71 foreach (MethodInfo mi in t.GetMethods())
72 {
73 MethodBuilder methodBuilder = classBuilder.DefineMethod(mi.Name, mi.Attributes, mi.GetType(), Type.EmptyTypes);
74 methodBuilder.SetParameters(paramsTypeArray);
75 //ParameterBuilder paramBuilder = methodBuilder.DefineParameter(1, ParameterAttributes.None, "args");
76
77 ilgen = methodBuilder.GetILGenerator();
78 //ilgen.Emit(OpCodes.Nop);
79 //ilgen.Emit(OpCodes.Ldarg_0);
80 //ilgen.Emit(OpCodes.Ldc_I4_0);
81 //ilgen.Emit(OpCodes.Ldelem_Ref);
82 //ilgen.MarkSequencePoint(doc, 6, 1, 6, 100);
83
84 //MethodInfo ExecuteFunction = typeof(ScriptAssemblies.IScript).GetMethod(
85 // "ExecuteFunction",
86 // executeFunctionTypeArray);
87
88 ilgen.DeclareLocal(typeof(string));
89 ilgen.Emit(OpCodes.Nop);
90 ilgen.Emit(OpCodes.Ldstr, mi.Name);
91 ilgen.Emit(OpCodes.Stloc_0);
92 ilgen.Emit(OpCodes.Ldarg_0);
93 ilgen.Emit(OpCodes.Ldloc_0);
94 ilgen.Emit(OpCodes.Ldarg_1);
95
96 // FieldInfo testInfo = classBuilder.
97 //BindingFlags.NonPublic | BindingFlags.Instance);
98
99 //ilgen.Emit(OpCodes.Ldfld, testInfo);
100
101 //ilgen.EmitCall(OpCodes.Call, ExecuteFunction, executeFunctionTypeArray);
102 ilgen.EmitCall(OpCodes.Call, typeof(System.Console).GetMethod("WriteLine"), executeFunctionTypeArray);
103
104 // // string.Format("Hello, {0} World!", toWhom)
105 // //
106 // ilgen.Emit(OpCodes.Ldstr, "Hello, {0} World!");
107 // ilgen.Emit(OpCodes.Ldarg_1);
108 // ilgen.Emit(OpCodes.Call, typeof(string).GetMethod
109 //("Format", new Type[] { typeof(string), typeof(object) }));
110
111 // // m_log.Debug("Hello, World!");
112 // //
113 // ilgen.Emit(OpCodes.Call, typeof(Console).GetMethod
114 // ("WriteLine", new Type[] { typeof(string) }));
115 ilgen.Emit(OpCodes.Ret);
116
117
118
119 //Label eom = ilgen.DefineLabel();
120 //ilgen.Emit(OpCodes.Br_S, eom);
121 //ilgen.MarkLabel(eom);
122 //ilgen.Emit(OpCodes.Ret);
123 //Type test = methodBuilder.SetParameters();
124
125
126 //methodBuilder.SetParameters(typeof (object[]));
127
128
129 }
130 }
131
132
133 //// Two fields: m_firstname, m_lastname
134 //FieldBuilder fBuilderFirstName = classBuilder.DefineField("m_firstname", typeof(string), FieldAttributes.Private);
135 //FieldBuilder fBuilderLastName = classBuilder.DefineField("m_lastname", typeof(string), FieldAttributes.Private);
136
137 //// Two properties for this object: FirstName, LastName
138 //PropertyBuilder pBuilderFirstName = classBuilder.DefineProperty("FirstName", System.Reflection.PropertyAttributes.HasDefault, typeof(string), null);
139 //PropertyBuilder pBuilderLastName = classBuilder.DefineProperty("LastName", System.Reflection.PropertyAttributes.HasDefault, typeof(string), null);
140
141 //// Custom attributes for get, set accessors
142 //MethodAttributes getSetAttr = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName;
143
144 //// get,set accessors for FirstName
145 //MethodBuilder mGetFirstNameBuilder = classBuilder.DefineMethod("get_FirstName", getSetAttr, typeof(string), Type.EmptyTypes);
146
147 //// Code generation
148 //ilgen = mGetFirstNameBuilder.GetILGenerator();
149 //ilgen.Emit(OpCodes.Ldarg_0);
150 //ilgen.Emit(OpCodes.Ldfld, fBuilderFirstName); // returning the firstname field
151 //ilgen.Emit(OpCodes.Ret);
152
153 //MethodBuilder mSetFirstNameBuilder = classBuilder.DefineMethod("set_FirstName", getSetAttr, null, new Type[] { typeof(string) });
154
155 //// Code generation
156 //ilgen = mSetFirstNameBuilder.GetILGenerator();
157 //ilgen.Emit(OpCodes.Ldarg_0);
158 //ilgen.Emit(OpCodes.Ldarg_1);
159 //ilgen.Emit(OpCodes.Stfld, fBuilderFirstName); // setting the firstname field from the first argument (1)
160 //ilgen.Emit(OpCodes.Ret);
161
162 //// get,set accessors for LastName
163 //MethodBuilder mGetLastNameBuilder = classBuilder.DefineMethod("get_LastName", getSetAttr, typeof(string), Type.EmptyTypes);
164
165 //// Code generation
166 //ilgen = mGetLastNameBuilder.GetILGenerator();
167 //ilgen.Emit(OpCodes.Ldarg_0);
168 //ilgen.Emit(OpCodes.Ldfld, fBuilderLastName); // returning the firstname field
169 //ilgen.Emit(OpCodes.Ret);
170
171 //MethodBuilder mSetLastNameBuilder = classBuilder.DefineMethod("set_LastName", getSetAttr, null, new Type[] { typeof(string) });
172
173 //// Code generation
174 //ilgen = mSetLastNameBuilder.GetILGenerator();
175 //ilgen.Emit(OpCodes.Ldarg_0);
176 //ilgen.Emit(OpCodes.Ldarg_1);
177 //ilgen.Emit(OpCodes.Stfld, fBuilderLastName); // setting the firstname field from the first argument (1)
178 //ilgen.Emit(OpCodes.Ret);
179
180 //// Assigning get/set accessors
181 //pBuilderFirstName.SetGetMethod(mGetFirstNameBuilder);
182 //pBuilderFirstName.SetSetMethod(mSetFirstNameBuilder);
183
184 //pBuilderLastName.SetGetMethod(mGetLastNameBuilder);
185 //pBuilderLastName.SetSetMethod(mSetLastNameBuilder);
186
187 //// Now, a custom method named GetFullName that concatenates FirstName and LastName properties
188 //MethodBuilder mGetFullNameBuilder = classBuilder.DefineMethod("GetFullName", MethodAttributes.Public, typeof(string), Type.EmptyTypes);
189
190 //// Code generation
191 //ilgen = mGetFullNameBuilder.GetILGenerator();
192 //ilgen.Emit(OpCodes.Ldarg_0);
193 //ilgen.Emit(OpCodes.Call, mGetFirstNameBuilder); // getting the firstname
194 //ilgen.Emit(OpCodes.Ldstr, " "); // an space
195 //ilgen.Emit(OpCodes.Ldarg_0);
196 //ilgen.Emit(OpCodes.Call, mGetLastNameBuilder); // getting the lastname
197
198 //// We need the 'Concat' method from string type
199 //MethodInfo concatMethod = typeof(String).GetMethod("Concat", new Type[] { typeof(string), typeof(string), typeof(string) });
200
201 //ilgen.Emit(OpCodes.Call, concatMethod); // calling concat and returning the result
202 //ilgen.Emit(OpCodes.Ret);
203
204 //// Another constructor that initializes firstname and lastname
205 //ConstructorBuilder ctorBuilder2 = classBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(string), typeof(string) });
206 //ctorBuilder2.DefineParameter(1, ParameterAttributes.In, "firstname");
207 //ctorBuilder2.DefineParameter(2, ParameterAttributes.In, "lastname");
208
209 //// Code generation
210 //ilgen = ctorBuilder2.GetILGenerator();
211
212 //// First of all, we need to call the base constructor,
213 //// the Object's constructor in this sample
214 //Type objType = Type.GetType("System.Object");
215 //ConstructorInfo objCtor = objType.GetConstructor(Type.EmptyTypes);
216
217 //ilgen.Emit(OpCodes.Ldarg_0);
218 //ilgen.Emit(OpCodes.Call, objCtor); // calling the Object's constructor
219
220 //ilgen.Emit(OpCodes.Ldarg_0);
221 //ilgen.Emit(OpCodes.Ldarg_1);
222 //ilgen.Emit(OpCodes.Call, mSetFirstNameBuilder); // setting the firstname field from the first argument (1)
223 //ilgen.Emit(OpCodes.Ldarg_0);
224 //ilgen.Emit(OpCodes.Ldarg_2);
225 //ilgen.Emit(OpCodes.Call, mSetLastNameBuilder); // setting the lastname field from the second argument (2)
226 //ilgen.Emit(OpCodes.Ret);
227
228 // Finally, create the type and save the assembly
229 classBuilder.CreateType();
230
231 asmBuilder.Save(asmFileName);
232 string toFile = Path.Combine(moveToDir, asmFileName);
233 if (File.Exists(toFile))
234 File.Delete(toFile);
235 File.Move(asmFileName, toFile);
236
237 //string a = "";
238 }
239 }
240}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs
deleted file mode 100644
index 9468c18..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/LoadUnloadStructure.cs
+++ /dev/null
@@ -1,49 +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 OpenSimulator 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.Collections.Generic;
30using System.Text;
31using OpenSim.ScriptEngine.Shared;
32
33namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
34{
35 public struct LoadUnloadStructure
36 {
37 public ScriptStructure Script;
38 public LUType Action;
39 public bool PostOnRez;
40 public int StartParam;
41
42 public enum LUType
43 {
44 Unknown = 0,
45 Load = 1,
46 Unload = 2
47 }
48 }
49}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1831e50..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.Components.DefaultScheduler")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Components.DefaultScheduler")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs
deleted file mode 100644
index 8c36764..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/Scheduler.cs
+++ /dev/null
@@ -1,55 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenMetaverse;
31using OpenSim.ScriptEngine.Shared;
32
33namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
34{
35 public class Scheduler : IScriptScheduler
36 {
37
38 private ScriptManager m_ScriptManager = new ScriptManager();
39 public void AddScript(ScriptStructure scriptStructure)
40 {
41 m_ScriptManager.AddScript(scriptStructure);
42 }
43
44 public void Removecript(uint id, UUID itemID)
45 {
46 m_ScriptManager.RemoveScript(id, itemID);
47 }
48
49 public void Close()
50 {
51 m_ScriptManager.Close();
52 }
53
54 }
55}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs
deleted file mode 100644
index 3c20f20..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptLoader.cs
+++ /dev/null
@@ -1,216 +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 OpenSimulator 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 */
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using OpenSim.ScriptEngine.Shared;
34using IScript=OpenSim.Region.ScriptEngine.Shared.ScriptBase.IScript;
35
36namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
37{
38 public class ScriptLoader : IScriptLoader
39 {
40 //
41 // This class does AppDomain handling and loading/unloading of
42 // scripts in it. It is instanced in "ScriptEngine" and controlled
43 // from "ScriptManager"
44 //
45 // 1. Create a new AppDomain if old one is full (or doesn't exist)
46 // 2. Load scripts into AppDomain
47 // 3. Unload scripts from AppDomain (stopping them and marking
48 // them as inactive)
49 // 4. Unload AppDomain completely when all scripts in it has stopped
50 //
51
52 public string Name { get { return "SECS.DotNetEngine.Scheduler.ScriptLoader"; } }
53 private int maxScriptsPerAppDomain = 10;
54
55 // Internal list of all AppDomains
56 private List<AppDomainStructure> appDomains =
57 new List<AppDomainStructure>();
58 private Dictionary<string, AppDomainStructure> AppDomainFiles = new Dictionary<string, AppDomainStructure>();
59 public readonly string[] AssembliesInAppDomain = new string[] { "OpenSim.ScriptEngine.Shared.Script.dll", "OpenSim.Region.ScriptEngine.Shared.dll" };
60
61 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62
63 // Structure to keep track of data around AppDomain
64 private class AppDomainStructure
65 {
66 public AppDomain CurrentAppDomain; // The AppDomain itself
67 public int ScriptsLoaded; // Number of scripts loaded into AppDomain
68 public int ScriptsWaitingUnload; // Number of dead scripts
69 }
70
71 // Current AppDomain
72 private AppDomainStructure currentAD;
73
74 private object getLock = new object(); // Mutex
75 private object freeLock = new object(); // Mutex
76
77 // Find a free AppDomain, creating one if necessary
78 private AppDomainStructure GetFreeAppDomain()
79 {
80 lock (getLock)
81 {
82 // Current full?
83 if (currentAD != null &&
84 currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
85 {
86 // Add it to AppDomains list and empty current
87 appDomains.Add(currentAD);
88 currentAD = null;
89 }
90 // No current
91 if (currentAD == null)
92 {
93 // Create a new current AppDomain
94 currentAD = new AppDomainStructure();
95 currentAD.CurrentAppDomain = PrepareNewAppDomain();
96 }
97
98 return currentAD;
99 }
100 }
101
102 private int AppDomainNameCount;
103 public ScriptAssemblies.IScript LoadScript(ScriptStructure script)
104 {
105 // Find next available AppDomain to put it in
106 AppDomainStructure FreeAppDomain;
107
108 // If we already have loaded file, then reuse that AppDomains
109 if (AppDomainFiles.ContainsKey(script.AssemblyFileName))
110 FreeAppDomain = AppDomainFiles[script.AssemblyFileName];
111 else
112 FreeAppDomain = GetFreeAppDomain();
113
114 // Set script object AppDomain
115 script.AppDomain = FreeAppDomain.CurrentAppDomain;
116
117 // Create instance of script
118 ScriptAssemblies.IScript mbrt = (ScriptAssemblies.IScript)
119 FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(
120 script.AssemblyFileName, "ScriptAssemblies.Script");
121 //, true, BindingFlags.CreateInstance, null);
122 FreeAppDomain.ScriptsLoaded++;
123
124 return mbrt;
125 }
126
127 // Create and prepare a new AppDomain for scripts
128 private AppDomain PrepareNewAppDomain()
129 {
130 // Create and prepare a new AppDomain
131 AppDomainNameCount++;
132
133 // TODO: Currently security match current appdomain
134
135 // Construct and initialize settings for a second AppDomain.
136 AppDomainSetup ads = new AppDomainSetup();
137 ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
138 ads.DisallowBindingRedirects = true;
139 ads.DisallowCodeDownload = true;
140 ads.LoaderOptimization = LoaderOptimization.MultiDomainHost;
141 ads.ShadowCopyFiles = "false"; // Disable shadowing
142 ads.ConfigurationFile =
143 AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
144
145 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" +
146 AppDomainNameCount, null, ads);
147
148 foreach (string file in AssembliesInAppDomain)
149 {
150 m_log.InfoFormat("[{0}] AppDomain Loading: \"{1}\"->\"{2}\".", Name, file,
151 AssemblyName.GetAssemblyName(file).ToString());
152 AD.Load(AssemblyName.GetAssemblyName(file));
153 }
154
155 // Return the new AppDomain
156 return AD;
157 }
158
159 // Unload appdomains that are full and have only dead scripts
160 private void UnloadAppDomains()
161 {
162 lock (freeLock)
163 {
164 // Go through all
165 foreach (AppDomainStructure ads in new ArrayList(appDomains))
166 {
167 // Don't process current AppDomain
168 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
169 {
170 // Not current AppDomain
171 // Is number of unloaded bigger or equal to number of loaded?
172 if (ads.ScriptsLoaded <= ads.ScriptsWaitingUnload)
173 {
174 // Remove from internal list
175 appDomains.Remove(ads);
176
177 // Unload
178 AppDomain.Unload(ads.CurrentAppDomain);
179 }
180 }
181 }
182 }
183 }
184
185 // Increase "dead script" counter for an AppDomain
186 public void StopScript(AppDomain ad)
187 {
188 lock (freeLock)
189 {
190 // Check if it is current AppDomain
191 if (currentAD.CurrentAppDomain == ad)
192 {
193 // Yes - increase
194 currentAD.ScriptsWaitingUnload++;
195 return;
196 }
197
198 // Lopp through all AppDomains
199 foreach (AppDomainStructure ads in new ArrayList(appDomains))
200 {
201 if (ads.CurrentAppDomain == ad)
202 {
203 // Found it
204 ads.ScriptsWaitingUnload++;
205 break;
206 }
207 }
208 }
209
210 UnloadAppDomains(); // Outsite lock, has its own GetLock
211 }
212
213
214
215 }
216} \ No newline at end of file
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs
deleted file mode 100644
index 3dad902..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager.cs
+++ /dev/null
@@ -1,203 +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 OpenSimulator 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.Collections.Generic;
30using System.Diagnostics;
31using System.Reflection;
32using System.Text;
33using System.Threading;
34using log4net;
35using OpenMetaverse;
36using OpenSim.Region.ScriptEngine.Shared;
37using OpenSim.ScriptEngine.Shared;
38using EventParams=OpenSim.ScriptEngine.Shared.EventParams;
39
40namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
41{
42 public partial class ScriptManager: IScriptExecutor
43 {
44 private const int NoWorkSleepMs = 50;
45 private const int NoWorkSleepMsInc = 1; // How much time to increase wait with on every iteration
46 private const int NoWorkSleepMsIncMax = 300; // Max time to wait
47
48 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 public string Name { get { return "SECS.DotNetEngine.ScriptManager"; } }
50 private static Thread ScriptLoadUnloadThread;
51 public Dictionary<uint, Dictionary<UUID, ScriptStructure>> Scripts = new Dictionary<uint, Dictionary<UUID, ScriptStructure>>();
52
53 private RegionInfoStructure CurrentRegion;
54 public void Initialize(RegionInfoStructure currentRegion)
55 {
56 CurrentRegion = currentRegion;
57 }
58
59 public ScriptManager()
60 {
61 ScriptLoadUnloadThread = new Thread(LoadUnloadLoop);
62 ScriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
63 ScriptLoadUnloadThread.IsBackground = true;
64 ScriptLoadUnloadThread.Start();
65 }
66 public void Close() { }
67
68 private void LoadUnloadLoop ()
69 {
70 int _NoWorkSleepMsInc = 0;
71 while (true)
72 {
73 if (DoScriptLoadUnload())
74 {
75 // We found work, reset counter
76 _NoWorkSleepMsInc = NoWorkSleepMs;
77 } else
78 {
79 // We didn't find work
80 // Sleep
81 Thread.Sleep(NoWorkSleepMs + NoWorkSleepMsInc);
82 // Increase sleep delay
83 _NoWorkSleepMsInc += NoWorkSleepMsInc;
84 // Make sure we don't exceed max
85 if (_NoWorkSleepMsInc > NoWorkSleepMsIncMax)
86 _NoWorkSleepMsInc = NoWorkSleepMsIncMax;
87 }
88 }
89 }
90
91 #region Add/Remove/Find script functions for our Script memory structure
92 private void MemAddScript(ScriptStructure script)
93 {
94 lock (scriptLock)
95 {
96 // Create object if it doesn't exist
97 if (!Scripts.ContainsKey(script.LocalID))
98 Scripts.Add(script.LocalID, new Dictionary<UUID, ScriptStructure>());
99
100 // Delete script if it exists
101 Dictionary<UUID, ScriptStructure> Obj;
102 if (Scripts.TryGetValue(script.LocalID, out Obj))
103 if (Obj.ContainsKey(script.ItemID) == true)
104 Obj.Remove(script.ItemID);
105
106 // Add to object
107 Obj.Add(script.ItemID, script);
108 }
109 }
110 private void MemRemoveScript(uint LocalID, UUID ItemID)
111 {
112 // TODO: Also clean up command queue and async commands for object
113 lock (scriptLock)
114 {
115 // Create object if it doesn't exist
116 if (!Scripts.ContainsKey(LocalID))
117 return;
118
119 // Delete script if it exists
120 Dictionary<UUID, ScriptStructure> Obj;
121 if (Scripts.TryGetValue(LocalID, out Obj))
122 if (Obj.ContainsKey(ItemID) == true)
123 Obj.Remove(ItemID);
124
125 // Empty?
126 if (Obj.Count == 0)
127 Scripts.Remove(LocalID);
128
129 }
130 }
131 public bool TryGetScript(uint localID, UUID itemID, ref ScriptStructure script)
132 {
133 lock (scriptLock)
134 {
135
136 if (Scripts.ContainsKey(localID) == false)
137 return false;
138
139 Dictionary<UUID, ScriptStructure> Obj;
140 if (Scripts.TryGetValue(localID, out Obj))
141 if (Obj.ContainsKey(itemID) == false)
142 return false;
143
144 // Get script
145 return Obj.TryGetValue(itemID, out script);
146 }
147 }
148 public ScriptStructure GetScript(uint localID, UUID itemID)
149 {
150 lock (scriptLock)
151 {
152
153 if (Scripts.ContainsKey(localID) == false)
154 throw new Exception("No script with LocalID " + localID + " was found.");
155
156 Dictionary<UUID, ScriptStructure> Obj;
157 if (Scripts.TryGetValue(localID, out Obj))
158 if (Obj.ContainsKey(itemID) == false)
159 throw new Exception("No script with ItemID " + itemID + " was found.");
160
161 // Get script
162 return Obj[itemID];
163 }
164 }
165 public bool TryGetScripts(uint localID, ref Dictionary<UUID, ScriptStructure> returnList)
166 {
167 Dictionary<UUID, ScriptStructure> getList = GetScripts(localID);
168 if (getList != null)
169 {
170 returnList = getList;
171 return true;
172 }
173 return false;
174 }
175 public Dictionary<UUID, ScriptStructure> GetScripts(uint localID)
176 {
177 lock (scriptLock)
178 {
179
180 if (Scripts.ContainsKey(localID) == false)
181 return null;
182 return Scripts[localID];
183 }
184 }
185 #endregion
186
187 public void ExecuteCommand(EventParams p)
188 {
189 ScriptStructure ss = new ScriptStructure();
190 if (TryGetScript(p.LocalID, p.ItemID, ref ss))
191 ExecuteCommand(ref ss, p);
192 }
193
194 public void ExecuteCommand(ref ScriptStructure scriptContainer, EventParams p)
195 {
196 m_log.DebugFormat("[{0}] ######################################################", Name);
197 m_log.DebugFormat("[{0}] Command execution ItemID {1}: \"{2}\".", Name, scriptContainer.ItemID, p.EventName);
198 scriptContainer.ExecuteEvent(p);
199 m_log.DebugFormat("[{0}] ######################################################", Name);
200 }
201
202 }
203}
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs
deleted file mode 100644
index dd72dbf..0000000
--- a/OpenSim/ScriptEngine/Components/DotNetEngine/Scheduler/ScriptManager_ScriptLoadUnload.cs
+++ /dev/null
@@ -1,287 +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 OpenSimulator 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.Collections.Generic;
30using System.Globalization;
31using System.Reflection;
32using System.Text;
33using System.Threading;
34using log4net;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.ScriptEngine.Interfaces;
39using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
40using OpenSim.ScriptEngine.Shared;
41
42namespace OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler
43{
44 public partial class ScriptManager
45 {
46 private Queue<LoadUnloadStructure> LUQueue = new Queue<LoadUnloadStructure>();
47 private int LoadUnloadMaxQueueSize = 500;
48 private Object scriptLock = new Object();
49 //private Dictionary<InstanceData, DetectParams[]> detparms = new Dictionary<InstanceData, DetectParams[]>();
50
51 // Load/Unload structure
52
53
54 public void AddScript(ScriptStructure script)
55 {
56 lock (LUQueue)
57 {
58 if ((LUQueue.Count >= LoadUnloadMaxQueueSize))
59 {
60 m_log.ErrorFormat("[{0}] ERROR: Load queue count is at {1} of max {2}. Ignoring load request for script LocalID: {3}, ItemID: {4}.",
61 Name, LUQueue.Count, LoadUnloadMaxQueueSize, script.LocalID, script.ItemID);
62 return;
63 }
64
65 LoadUnloadStructure ls = new LoadUnloadStructure();
66 ls.Script = script;
67 ls.Action = LoadUnloadStructure.LUType.Load;
68 LUQueue.Enqueue(ls);
69 }
70
71 }
72 public void RemoveScript(uint localID, UUID itemID)
73 {
74 LoadUnloadStructure ls = new LoadUnloadStructure();
75
76 // See if we can find script
77 if (!TryGetScript(localID, itemID, ref ls.Script))
78 {
79 // Set manually
80 ls.Script.LocalID = localID;
81 ls.Script.ItemID = itemID;
82 }
83 ls.Script.StartParam = 0;
84
85 ls.Action = LoadUnloadStructure.LUType.Unload;
86 ls.PostOnRez = false;
87
88 lock (LUQueue)
89 {
90 LUQueue.Enqueue(ls);
91 }
92 }
93
94 internal bool DoScriptLoadUnload()
95 {
96 bool ret = false;
97 // if (!m_started)
98 // return;
99
100 lock (LUQueue)
101 {
102 if (LUQueue.Count > 0)
103 {
104 LoadUnloadStructure item = LUQueue.Dequeue();
105 ret = true;
106
107 if (item.Action == LoadUnloadStructure.LUType.Unload)
108 {
109 _StopScript(item.Script.LocalID, item.Script.ItemID);
110 RemoveScript(item.Script.LocalID, item.Script.ItemID);
111 }
112 else if (item.Action == LoadUnloadStructure.LUType.Load)
113 {
114 m_log.DebugFormat("[{0}] Loading script", Name);
115 _StartScript(item);
116 }
117 }
118 }
119 return ret;
120 }
121
122 //public void _StartScript(uint localID, UUID itemID, string Script, int startParam, bool postOnRez)
123 private void _StartScript(LoadUnloadStructure ScriptObject)
124 {
125 m_log.DebugFormat(
126 "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
127 Name, ScriptObject.Script.LocalID, ScriptObject.Script.ItemID);
128
129 // We will initialize and start the script.
130 // It will be up to the script itself to hook up the correct events.
131
132 SceneObjectPart m_host = ScriptObject.Script.RegionInfo.Scene.GetSceneObjectPart(ScriptObject.Script.LocalID);
133
134 if (null == m_host)
135 {
136 m_log.ErrorFormat(
137 "[{0}]: Could not find scene object part corresponding " +
138 "to localID {1} to start script",
139 Name, ScriptObject.Script.LocalID);
140
141 return;
142 }
143
144 //UUID assetID = UUID.Zero;
145 TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
146 //if (m_host.TaskInventory.TryGetValue(ScriptObject.Script.ItemID, out taskInventoryItem))
147 // assetID = taskInventoryItem.AssetID;
148
149 ScenePresence presence =
150 ScriptObject.Script.RegionInfo.Scene.GetScenePresence(taskInventoryItem.OwnerID);
151
152 CultureInfo USCulture = new CultureInfo("en-US");
153 Thread.CurrentThread.CurrentCulture = USCulture;
154
155 try
156 {
157 //
158 // Compile script to an assembly
159 //
160 //TODO: DEBUG
161 BaseClassFactory.MakeBaseClass(ScriptObject.Script);
162
163 m_log.DebugFormat("[{0}] Compiling script {1}", Name, ScriptObject.Script.Name);
164
165 string fileName = "";
166 try
167 {
168 IScriptCompiler compiler =
169 ScriptObject.Script.RegionInfo.FindCompiler(ScriptObject.Script.ScriptMetaData);
170 //RegionInfoStructure currentRegionInfo = ScriptObject.Script.RegionInfo;
171 fileName = compiler.Compile(ScriptObject.Script.ScriptMetaData,
172 ref ScriptObject.Script.Source);
173 ScriptObject.Script.AssemblyFileName = fileName;
174 }
175 catch (Exception e)
176 {
177 m_log.ErrorFormat("[{0}] Internal error while compiling \"{1}\": {2}", Name, ScriptObject.Script.Name, e.ToString());
178 }
179 m_log.DebugFormat("[{0}] Compiled \"{1}\" to assembly: \"{2}\".", Name, ScriptObject.Script.Name, fileName);
180
181 // Add it to our script memstruct
182 MemAddScript(ScriptObject.Script);
183
184 ScriptAssemblies.IScript CompiledScript;
185 CompiledScript = CurrentRegion.ScriptLoader.LoadScript(ScriptObject.Script);
186 ScriptObject.Script.State = "default";
187 ScriptObject.Script.ScriptObject = CompiledScript;
188 ScriptObject.Script.Disabled = false;
189 ScriptObject.Script.Running = true;
190 //id.LineMap = LSLCompiler.LineMap();
191 //id.Script = CompiledScript;
192 //id.Source = item.Script.Script;
193 //item.StartParam = startParam;
194
195
196
197 // TODO: Fire the first start-event
198 //int eventFlags =
199 // m_scriptEngine.m_ScriptManager.GetStateEventFlags(
200 // localID, itemID);
201
202 //m_host.SetScriptEvents(itemID, eventFlags);
203 ScriptObject.Script.RegionInfo.Executors_Execute(ScriptObject.Script,
204 new EventParams(ScriptObject.Script.LocalID, ScriptObject.Script.ItemID, "state_entry", new object[] { }, new Region.ScriptEngine.Shared.DetectParams[0])
205 );
206
207 if (ScriptObject.PostOnRez)
208 {
209 ScriptObject.Script.RegionInfo.Executors_Execute(ScriptObject.Script,
210 new EventParams(ScriptObject.Script.LocalID, "on_rez", new object[]
211 {new Region.ScriptEngine.Shared.LSL_Types.LSLInteger(ScriptObject.StartParam)
212 }, new Region.ScriptEngine.Shared.DetectParams[0]));
213 }
214 }
215 catch (Exception e) // LEGIT: User Scripting
216 {
217 if (presence != null && (!ScriptObject.PostOnRez))
218 presence.ControllingClient.SendAgentAlertMessage(
219 "Script saved with errors, check debug window!",
220 false);
221 try
222 {
223 // DISPLAY ERROR INWORLD
224 string text = "Error compiling script:\n" +
225 e.Message.ToString();
226 if (text.Length > 1100)
227 text = text.Substring(0, 1099);
228
229 ScriptObject.Script.RegionInfo.Scene.SimChat(Utils.StringToBytes(text),
230 ChatTypeEnum.DebugChannel, 2147483647,
231 m_host.AbsolutePosition, m_host.Name, m_host.UUID,
232 false);
233 }
234 catch (Exception e2) // LEGIT: User Scripting
235 {
236 m_log.Error("[" +
237 Name +
238 "]: Error displaying error in-world: " +
239 e2.ToString());
240 m_log.Error("[" +
241 Name + "]: " +
242 "Errormessage: Error compiling script:\r\n" +
243 e2.Message.ToString());
244 }
245 }
246 }
247
248
249
250 public void _StopScript(uint localID, UUID itemID)
251 {
252 ScriptStructure ss = new ScriptStructure();
253 if (!TryGetScript(localID, itemID, ref ss))
254 return;
255
256 m_log.DebugFormat("[{0}] Unloading script", Name);
257
258 // Stop long command on script
259 //AsyncCommandManager.RemoveScript(ss);
260
261 try
262 {
263 // Get AppDomain
264 // Tell script not to accept new requests
265 ss.Running = false;
266 ss.Disabled = true;
267 //AppDomain ad = ss.AppDomain;
268
269 // Remove from internal structure
270 MemRemoveScript(localID, itemID);
271
272 // TODO: Tell AppDomain that we have stopped script
273
274 }
275 catch (Exception e) // LEGIT: User Scripting
276 {
277 m_log.Error("[" +
278 Name +
279 "]: Exception stopping script localID: " +
280 localID + " LLUID: " + itemID.ToString() +
281 ": " + e.ToString());
282 }
283 }
284
285
286 }
287}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
deleted file mode 100644
index 3b8a0ae..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
+++ /dev/null
@@ -1,196 +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 OpenSimulator 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 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using System.Text.RegularExpressions;
32using log4net;
33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.ApplicationPlugins.ScriptEngine;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
39using OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler;
40using OpenSim.ScriptEngine.Shared;
41using ComponentFactory = OpenSim.ApplicationPlugins.ScriptEngine.ComponentFactory;
42
43namespace OpenSim.ScriptEngine.Engines.DotNetEngine
44{
45 // This is a sample engine
46 public partial class DotNetEngine : IScriptEngine
47 {
48
49 //private string[] _ComponentNames = new string[] {
50 // "Commands_LSL",
51 // "Commands_OSSL",
52 // "Compiler_CS",
53 // "Compiler_JS",
54 // "Compiler_LSL",
55 // "Compiler_VB",
56 // "LSLEventProvider",
57 // "Scheduler"
58 // };
59 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60
61 public string Name { get { return "SECS.DotNetEngine"; } }
62 //public bool IsSharedModule { get { return true; } }
63 internal RegionInfoStructure RegionInfo;
64
65 private string[] commandNames = new string[]
66 {
67 "Commands_LSL"
68 };
69
70 private string[] compilerNames = new string[]
71 {
72 "Compiler_CS",
73 "Compiler_JS",
74 "Compiler_LSL",
75 "Compiler_YP",
76 "Compiler_VB"
77 };
78 private string[] schedulerNames = new string[]
79 {
80 "Scheduler"
81 };
82
83 //internal IScriptLoader m_ScriptLoader;
84 internal LSLEventProvider m_LSLEventProvider;
85 //internal IScriptExecutor m_Executor;
86 //internal Dictionary<string, IScriptCompiler> Compilers = new Dictionary<string, IScriptCompiler>();
87 internal Dictionary<string, IScriptScheduler> Schedulers = new Dictionary<string, IScriptScheduler>();
88 public static Dictionary<string, IScriptCompiler> Compilers = new Dictionary<string, IScriptCompiler>();
89// private static bool haveInitialized = false;
90
91 public DotNetEngine()
92 {
93 RegionInfo = new RegionInfoStructure();
94 RegionInfo.Compilers = Compilers;
95 RegionInfo.Schedulers = Schedulers;
96 RegionInfo.Executors = new Dictionary<string, IScriptExecutor>();
97 RegionInfo.CommandProviders = new Dictionary<string, IScriptCommandProvider>();
98 RegionInfo.EventProviders = new Dictionary<string, IScriptEventProvider>();
99 }
100
101 public void Initialise(Scene scene, IConfigSource source)
102 {
103 RegionInfo.Scene = scene;
104 RegionInfo.ConfigSource = source;
105
106 m_log.DebugFormat("[{0}] Initializing components", Name);
107 InitializeComponents();
108 }
109
110 public void PostInitialise() { }
111
112 /// <summary>
113 /// Called on region close
114 /// </summary>
115 public void Close()
116 {
117 ComponentClose();
118 }
119 #region Initialize the Script Engine Components we need
120 public void InitializeComponents()
121 {
122 string cname = "";
123 m_log.DebugFormat("[{0}] Component initialization", Name);
124 // Initialize an instance of all module we want
125 try
126 {
127 cname = "ScriptManager";
128 m_log.DebugFormat("[{0}] Executor: {1}", Name, cname);
129 RegionInfo.Executors.Add(cname,
130 ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor);
131
132 cname = "ScriptLoader";
133 m_log.DebugFormat("[{0}] ScriptLoader: {1}", Name, cname);
134 RegionInfo.ScriptLoader =
135 ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor as ScriptLoader;
136
137 // CommandProviders
138 foreach (string cn in commandNames)
139 {
140 cname = cn;
141 m_log.DebugFormat("[{0}] CommandProvider: {1}", Name, cname);
142 RegionInfo.CommandProviders.Add(cname,
143 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
144 IScriptCommandProvider);
145 }
146
147 // Compilers
148 foreach (string cn in compilerNames)
149 {
150 cname = cn;
151 m_log.DebugFormat("[{0}] Compiler: {1}", Name, cname);
152 RegionInfo.Compilers.Add(cname,
153 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
154 IScriptCompiler);
155 }
156
157 // Schedulers
158 foreach (string cn in schedulerNames)
159 {
160 cname = cn;
161 m_log.DebugFormat("[{0}] Scheduler: {1}", Name, cname);
162 RegionInfo.Schedulers.Add(cname,
163 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
164 IScriptScheduler);
165 }
166
167 // Event provider
168 cname = "LSLEventProvider";
169 m_log.DebugFormat("[{0}] EventProvider: {1}", Name, cname);
170 IScriptEventProvider sep = ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptEventProvider;
171 RegionInfo.EventProviders.Add(cname, sep);
172 m_LSLEventProvider = sep as LSLEventProvider;
173
174 // Hook up events
175 m_LSLEventProvider.RezScript += Events_RezScript;
176 m_LSLEventProvider.RemoveScript += Events_RemoveScript;
177 }
178 catch (Exception e)
179 {
180 m_log.ErrorFormat("[{0}] Exception while loading \"{1}\": {2}", Name, cname, e.ToString());
181 }
182 }
183
184 private void ComponentClose()
185 {
186 // Close schedulers
187 foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
188 {
189 scheduler.Close();
190 }
191 }
192
193 #endregion
194
195 }
196}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
deleted file mode 100644
index a113c1e..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
+++ /dev/null
@@ -1,95 +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 OpenSimulator 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.Collections.Generic;
30using System.Text;
31using OpenMetaverse;
32using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
33using OpenSim.ScriptEngine.Shared;
34
35namespace OpenSim.ScriptEngine.Engines.DotNetEngine
36{
37 public partial class DotNetEngine
38 {
39
40 //internal Dictionary<int, IScriptScheduler> ScriptMapping = new Dictionary<int, IScriptScheduler>();
41
42
43 //
44 // HANDLE EVENTS FROM SCRIPTS
45 // We will handle script add, change and remove events outside of command pipeline
46 //
47 #region Script Add/Change/Remove
48 void Events_RezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
49 {
50 // ###
51 // # New script created
52 // ###
53 m_log.DebugFormat(
54 "[{0}] NEW SCRIPT: localID: {1}, itemID: {2}, startParam: {3}, postOnRez: {4}, engine: {5}",
55 Name, localID, itemID, startParam, postOnRez, engine);
56
57 // Make a script object
58 ScriptStructure scriptObject = new ScriptStructure();
59 scriptObject.RegionInfo = RegionInfo;
60 scriptObject.LocalID = localID;
61 scriptObject.ItemID = itemID;
62 scriptObject.Source = script;
63
64 //
65 // Get MetaData from script header
66 //
67 ScriptMetaData scriptMetaData = ScriptMetaData.Extract(ref script);
68 scriptObject.ScriptMetaData = scriptMetaData;
69 foreach (string key in scriptObject.ScriptMetaData.Keys)
70 {
71 m_log.DebugFormat("[{0}] Script metadata: Key: \"{1}\", Value: \"{2}\".", Name, key, scriptObject.ScriptMetaData[key]);
72 }
73
74 //
75 // Load this assembly
76 //
77 // TODO: Use Executor to send a command instead?
78 m_log.DebugFormat("[{0}] Adding script to scheduler", Name);
79 RegionInfo.FindScheduler(scriptObject.ScriptMetaData).AddScript(scriptObject);
80 // Add to our internal mapping
81 //ScriptMapping.Add(itemID, Schedulers[scheduler]);
82 }
83
84 private void Events_RemoveScript(uint localID, UUID itemID)
85 {
86 // Tell all schedulers to remove this item
87 foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
88 {
89 scheduler.Removecript(localID, itemID);
90 }
91 }
92 #endregion
93
94 }
95}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
deleted file mode 100644
index bca9c2c..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 OpenSimulator 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.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Engines.DotNetEngine")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Engines.DotNetEngine")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("1d1c68a7-026f-4556-a060-4af69f488d2a")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]