public static Assembly compile(this string pathToFileToCompile, bool generateDebugSymbols) { PublicDI.CurrentScript = pathToFileToCompile; var csharpCompiler = new CSharp_FastCompiler().generateDebugSymbols(generateDebugSymbols); var compileProcess = new AutoResetEvent(false); csharpCompiler.set_OnCompileFail(() => compileProcess.Set()); csharpCompiler.set_OnCompileOK (() => compileProcess.Set()); O2Thread.mtaThread(()=> csharpCompiler.compileSourceCode(pathToFileToCompile.contents())); compileProcess.WaitOne(); return csharpCompiler.assembly(); }
public static Assembly compile_CodeSnippet(this string codeSnipptet, bool generateDebugSymbols) { //Note we can't use the precompiled engines here since there is an issue of the resolution of this code dependencies var csharpCompiler = new CSharp_FastCompiler().debugMode(true) .generateDebugSymbols(generateDebugSymbols); var compileProcess = new AutoResetEvent(false); csharpCompiler.set_OnAstFail (() => compileProcess.Set()); csharpCompiler.set_OnCompileFail(() => compileProcess.Set()); csharpCompiler.set_OnCompileOK (() => compileProcess.Set()); csharpCompiler.compileSnippet(codeSnipptet); compileProcess.WaitOne(); var assembly = csharpCompiler.assembly(); return assembly; }