public CompilationResult CompileFromSource( TextWriter errorWriter, TextWriter warningWriter, TextWriter logWriter, string sourceCodePath, //string[] include string outputFilePath, string platformInfo, CompilerFlags flags ) { try { if (!File.Exists(sourceCodePath)) { throw new FileNotFoundException("Source code file not found.", sourceCodePath); } var platform = Platforms.GetPlatformByName(platformInfo); if (platform == null) { throw new Exception("Invalid platform name."); } flags = platform.ReviseFlags(flags); var outputObjPath = Path.Combine(Path.GetDirectoryName(outputFilePath), "obj"); if (!Directory.Exists(outputObjPath)) { Directory.CreateDirectory(outputObjPath); } CompileFromSource(sourceCodePath, outputObjPath, outputFilePath, platform, flags, errorWriter, warningWriter, logWriter); return(new CompilationResult(true)); } catch (Exception ex) { var dispatchInfo = ExceptionDispatchInfo.Capture(ex); return(new CompilationResult(false) { Exception = dispatchInfo.SourceException }); } }