diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/Compiler.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/Compiler.cs | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs b/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs index 980d9e6..3ff7ce0 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs | |||
@@ -253,10 +253,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
253 | string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( | 253 | string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( |
254 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 254 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
255 | FilePrefix + "_compiled_" + asset + ".dll")); | 255 | FilePrefix + "_compiled_" + asset + ".dll")); |
256 | // string OutFile = Path.Combine(ScriptEnginesPath, | 256 | // string OutFile = Path.Combine(ScriptEnginesPath, |
257 | // FilePrefix + "_compiled_" + asset + ".dll"); | 257 | // FilePrefix + "_compiled_" + asset + ".dll"); |
258 | 258 | ||
259 | if(File.Exists(OutFile)) | 259 | if (File.Exists(OutFile)) |
260 | return OutFile; | 260 | return OutFile; |
261 | 261 | ||
262 | if (!Directory.Exists(ScriptEnginesPath)) | 262 | if (!Directory.Exists(ScriptEnginesPath)) |
@@ -271,7 +271,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
271 | } | 271 | } |
272 | 272 | ||
273 | if (!Directory.Exists(Path.Combine(ScriptEnginesPath, | 273 | if (!Directory.Exists(Path.Combine(ScriptEnginesPath, |
274 | m_scriptEngine.World.RegionInfo.RegionID.ToString()))) | 274 | m_scriptEngine.World.RegionInfo.RegionID.ToString()))) |
275 | { | 275 | { |
276 | try | 276 | try |
277 | { | 277 | { |
@@ -284,7 +284,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
284 | 284 | ||
285 | enumCompileType l = DefaultCompileLanguage; | 285 | enumCompileType l = DefaultCompileLanguage; |
286 | 286 | ||
287 | |||
288 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) | 287 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) |
289 | l = enumCompileType.cs; | 288 | l = enumCompileType.cs; |
290 | if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) | 289 | if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) |
@@ -334,7 +333,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
334 | 333 | ||
335 | // End of insert | 334 | // End of insert |
336 | 335 | ||
337 | |||
338 | switch (l) | 336 | switch (l) |
339 | { | 337 | { |
340 | case enumCompileType.cs: | 338 | case enumCompileType.cs: |
@@ -368,27 +366,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
368 | 366 | ||
369 | private static string CreateCSCompilerScript(string compileScript) | 367 | private static string CreateCSCompilerScript(string compileScript) |
370 | { | 368 | { |
371 | |||
372 | |||
373 | compileScript = String.Empty + | 369 | compileScript = String.Empty + |
374 | "using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" + | 370 | "using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" + |
375 | String.Empty + "namespace SecondLife { " + | 371 | String.Empty + "namespace SecondLife { " + |
376 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" + | 372 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" + |
377 | @"public Script() { } " + | 373 | @"public Script() { } " + |
378 | compileScript + | 374 | compileScript + |
379 | "} }\r\n"; | 375 | "} }\r\n"; |
380 | return compileScript; | 376 | return compileScript; |
381 | } | 377 | } |
382 | 378 | ||
383 | private static string CreateVBCompilerScript(string compileScript) | 379 | private static string CreateVBCompilerScript(string compileScript) |
384 | { | 380 | { |
385 | compileScript = String.Empty + | 381 | compileScript = String.Empty + |
386 | "Imports OpenSim.Region.ScriptEngine.XEngine.Script: Imports System.Collections.Generic: " + | 382 | "Imports OpenSim.Region.ScriptEngine.XEngine.Script: Imports System.Collections.Generic: " + |
387 | String.Empty + "NameSpace SecondLife:" + | 383 | String.Empty + "NameSpace SecondLife:" + |
388 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass: " + | 384 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass: " + |
389 | "\r\nPublic Sub New()\r\nEnd Sub: " + | 385 | "\r\nPublic Sub New()\r\nEnd Sub: " + |
390 | compileScript + | 386 | compileScript + |
391 | ":End Class :End Namespace\r\n"; | 387 | ":End Class :End Namespace\r\n"; |
392 | return compileScript; | 388 | return compileScript; |
393 | } | 389 | } |
394 | 390 | ||
@@ -404,8 +400,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
404 | // Output assembly name | 400 | // Output assembly name |
405 | scriptCompileCounter++; | 401 | scriptCompileCounter++; |
406 | string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( | 402 | string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( |
407 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 403 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
408 | FilePrefix + "_compiled_" + asset + ".dll")); | 404 | FilePrefix + "_compiled_" + asset + ".dll")); |
409 | #if DEBUG | 405 | #if DEBUG |
410 | // m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); | 406 | // m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); |
411 | #endif | 407 | #endif |
@@ -490,8 +486,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
490 | foreach (CompilerError CompErr in results.Errors) | 486 | foreach (CompilerError CompErr in results.Errors) |
491 | { | 487 | { |
492 | errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + | 488 | errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + |
493 | ", Error Number: " + CompErr.ErrorNumber + | 489 | ", Error Number: " + CompErr.ErrorNumber + |
494 | ", '" + CompErr.ErrorText + "'\r\n"; | 490 | ", '" + CompErr.ErrorText + "'\r\n"; |
495 | } | 491 | } |
496 | if (!File.Exists(OutFile)) | 492 | if (!File.Exists(OutFile)) |
497 | { | 493 | { |
@@ -499,7 +495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
499 | } | 495 | } |
500 | } | 496 | } |
501 | 497 | ||
502 | |||
503 | // | 498 | // |
504 | // NO ERRORS, BUT NO COMPILED FILE | 499 | // NO ERRORS, BUT NO COMPILED FILE |
505 | // | 500 | // |