Refactor compile and write code

This commit is contained in:
Cj 2024-06-20 19:20:32 -04:00
parent 5084db4179
commit c8b642ee0d

View File

@ -102,15 +102,26 @@ public class ReCodeItCrossCompiler
newProject = newDoc.Project;
}
await CompileProject(newProject);
}
}
private async Task CompileProject(Project project)
{
Logger.Log("Compiling Project...", ConsoleColor.Yellow);
var comp = await newProject.GetCompilationAsync();
var comp = await project.GetCompilationAsync();
foreach (var diag in comp.GetDiagnostics())
{
Logger.Log(diag.ToString());
}
WriteAssembly(comp);
}
private void WriteAssembly(Compilation comp)
{
using (var ms = new MemoryStream())
{
EmitResult emitResult = comp.Emit(ms);
@ -140,7 +151,6 @@ public class ReCodeItCrossCompiler
}
}
}
}
private async Task<Solution> LoadSolutionAsync(MSBuildWorkspace workspace, string solutionPath)
{