From 9511a8c76370f21e839114007dcd2b25c69b009a Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sat, 8 Nov 2008 17:35:48 +0000 Subject: Work in progress on SECS stuff. Have been holding it off until after 0.6 release. Still messy as hell and doesn't really work yet. Will undergo dramatic changes. AND MOST IMPORTANTLY: Will be conformed to work in coop with todays DNE and XEngine, hopefully one day providing a common interface for all components. --- .../DotNetEngine/Compilers/Compiler_CS.cs | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs') 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 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; +using System.CodeDom.Compiler; using System.Collections.Generic; using System.Text; -using OpenSim.ApplicationPlugins.ScriptEngine.Components; +using Microsoft.CSharp; +using OpenSim.ScriptEngine.Shared; namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers { - public class Compiler_CS: CompilerBase + public class Compiler_CS : CILCompiler, IScriptCompiler { - public override void Start() + private string[] ScriptUsing = new string[] + { + "System", + "OpenSim.ScriptEngine.Shared", + "OpenSim.Region.ScriptEngine.Shared", + "System.Collections.Generic" + }; + + public Compiler_CS() { + CompileProvider = new CSharpCodeProvider(); } - public override void Close() + public override string PreProcessScript(ref string script) { + string s = ""; + foreach (string u in ScriptUsing) + { + s += "using " + u + ";"; + } + + s += "\r\n" + + String.Empty + "namespace ScriptAssemblies { " + + String.Empty + "public class UserScript" + " : " + ScriptInheritFrom + " { \r\n" + + @"public Script() { } " + + script + + "} }\r\n"; + + return s; } + } } -- cgit v1.1