aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs64
1 files changed, 41 insertions, 23 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 5c8b4b5..58586c0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -272,41 +272,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
272 switch (l) 272 switch (l)
273 { 273 {
274 case enumCompileType.cs: 274 case enumCompileType.cs:
275 compileScript = String.Empty + 275 compileScript = CreateCSCompilerScript(compileScript);
276 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
277 String.Empty + "namespace SecondLife { " +
278 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
279 @"public Script() { } " +
280 compileScript +
281 "} }\r\n";
282 break; 276 break;
283 case enumCompileType.vb: 277 case enumCompileType.vb:
284 compileScript = String.Empty + 278 compileScript = CreateVBCompilerScript(compileScript);
285 "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " +
286 String.Empty + "NameSpace SecondLife:" +
287 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
288 "\r\nPublic Sub New()\r\nEnd Sub: " +
289 compileScript +
290 ":End Class :End Namespace\r\n";
291 break; 279 break;
292 case enumCompileType.js: 280 case enumCompileType.js:
293 compileScript = String.Empty + 281 compileScript = CreateJSCompilerScript(compileScript);
294 "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" +
295 "package SecondLife {\r\n" +
296 "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
297 compileScript +
298 "} }\r\n";
299 break; 282 break;
300 } 283 }
301 return CompileFromCSorVBText(compileScript, l); 284 return CompileFromDotNetText(compileScript, l);
285 }
286
287 private static string CreateJSCompilerScript(string compileScript)
288 {
289 compileScript = String.Empty +
290 "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" +
291 "package SecondLife {\r\n" +
292 "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
293 compileScript +
294 "} }\r\n";
295 return compileScript;
296 }
297
298 private static string CreateCSCompilerScript(string compileScript)
299 {
300 compileScript = String.Empty +
301 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
302 String.Empty + "namespace SecondLife { " +
303 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
304 @"public Script() { } " +
305 compileScript +
306 "} }\r\n";
307 return compileScript;
308 }
309
310 private static string CreateVBCompilerScript(string compileScript)
311 {
312 compileScript = String.Empty +
313 "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " +
314 String.Empty + "NameSpace SecondLife:" +
315 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
316 "\r\nPublic Sub New()\r\nEnd Sub: " +
317 compileScript +
318 ":End Class :End Namespace\r\n";
319 return compileScript;
302 } 320 }
303 321
304 /// <summary> 322 /// <summary>
305 /// Compile CS script to .Net assembly (.dll) 323 /// Compile .NET script to .Net assembly (.dll)
306 /// </summary> 324 /// </summary>
307 /// <param name="Script">CS script</param> 325 /// <param name="Script">CS script</param>
308 /// <returns>Filename to .dll assembly</returns> 326 /// <returns>Filename to .dll assembly</returns>
309 internal string CompileFromCSorVBText(string Script, enumCompileType lang) 327 internal string CompileFromDotNetText(string Script, enumCompileType lang)
310 { 328 {
311 string ext = "." + lang.ToString(); 329 string ext = "." + lang.ToString();
312 330