Refactor compile and write code
This commit is contained in:
parent
5084db4179
commit
c8b642ee0d
@ -102,15 +102,26 @@ public class ReCodeItCrossCompiler
|
|||||||
newProject = newDoc.Project;
|
newProject = newDoc.Project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await CompileProject(newProject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task CompileProject(Project project)
|
||||||
|
{
|
||||||
Logger.Log("Compiling Project...", ConsoleColor.Yellow);
|
Logger.Log("Compiling Project...", ConsoleColor.Yellow);
|
||||||
|
|
||||||
var comp = await newProject.GetCompilationAsync();
|
var comp = await project.GetCompilationAsync();
|
||||||
|
|
||||||
foreach (var diag in comp.GetDiagnostics())
|
foreach (var diag in comp.GetDiagnostics())
|
||||||
{
|
{
|
||||||
Logger.Log(diag.ToString());
|
Logger.Log(diag.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteAssembly(comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteAssembly(Compilation comp)
|
||||||
|
{
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
EmitResult emitResult = comp.Emit(ms);
|
EmitResult emitResult = comp.Emit(ms);
|
||||||
@ -140,7 +151,6 @@ public class ReCodeItCrossCompiler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<Solution> LoadSolutionAsync(MSBuildWorkspace workspace, string solutionPath)
|
private async Task<Solution> LoadSolutionAsync(MSBuildWorkspace workspace, string solutionPath)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user