LSL ScriptEngine now only needs to inherit from BaseClass and we will be MUCH closer to complete LSL support than we were yesterday.
parent
95b89096c4
commit
734f288290
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Microsoft.CSharp;
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
{
|
||||
class Compiler
|
||||
{
|
||||
private LSL2CS.Converter.LSL2CSConverter LSL_Converter = new LSL2CS.Converter.LSL2CSConverter();
|
||||
private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
|
||||
//private ICodeCompiler icc = codeProvider.CreateCompiler();
|
||||
public string Compile(string LSOFileName)
|
||||
{
|
||||
|
||||
|
||||
string OutFile = Path.GetFileNameWithoutExtension(LSOFileName);
|
||||
|
||||
// TODO: Add error handling
|
||||
string CS_Code = LSL_Converter.Convert(File.ReadAllText(LSOFileName));
|
||||
|
||||
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
|
||||
parameters.GenerateExecutable = true;
|
||||
parameters.OutputAssembly = OutFile;
|
||||
CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, CS_Code);
|
||||
|
||||
// TODO: Return errors to user somehow
|
||||
if (results.Errors.Count > 0)
|
||||
{
|
||||
foreach (CompilerError CompErr in results.Errors)
|
||||
{
|
||||
Console.WriteLine("Line number " + CompErr.Line +
|
||||
", Error Number: " + CompErr.ErrorNumber +
|
||||
", '" + CompErr.ErrorText + ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return OutFile;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -29,6 +29,8 @@ namespace LSL2CS.Converter
|
|||
public string Convert(string Script)
|
||||
{
|
||||
string Return = "";
|
||||
QUOTES.Clear();
|
||||
|
||||
|
||||
//
|
||||
// Prepare script for processing
|
||||
|
|
Loading…
Reference in New Issue