diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs index 9c72359..1286dc5 100644 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs +++ b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs | |||
@@ -25,20 +25,46 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.CodeDom.Compiler; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Text; | 30 | using System.Text; |
30 | using OpenSim.ApplicationPlugins.ScriptEngine.Components; | 31 | using Microsoft.CSharp; |
32 | using OpenSim.ScriptEngine.Shared; | ||
31 | 33 | ||
32 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | 34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers |
33 | { | 35 | { |
34 | public class Compiler_CS: CompilerBase | 36 | public class Compiler_CS : CILCompiler, IScriptCompiler |
35 | { | 37 | { |
36 | public override void Start() | 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() | ||
37 | { | 47 | { |
48 | CompileProvider = new CSharpCodeProvider(); | ||
38 | } | 49 | } |
39 | 50 | ||
40 | public override void Close() | 51 | public override string PreProcessScript(ref string script) |
41 | { | 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; | ||
42 | } | 67 | } |
68 | |||
43 | } | 69 | } |
44 | } | 70 | } |