mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix scripting system to provide more information in errors
Also make log lines for scripting more uniform
This commit is contained in:
parent
0e7423d1d9
commit
78f9c35800
4 changed files with 19 additions and 14 deletions
|
|
@ -24,7 +24,7 @@ namespace DynamicRun.Builder
|
|||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
|
||||
ConsoleIO.WriteLogLine(assemblyLoadContextWeakRef.Item1.IsAlive ? "Script continues to run." : "Script finished!");
|
||||
ConsoleIO.WriteLogLine(assemblyLoadContextWeakRef.Item1.IsAlive ? "[Script] Script continues to run." : "[Script] Script finished!");
|
||||
return assemblyLoadContextWeakRef.Item2;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,15 +23,11 @@ namespace DynamicRun.Builder
|
|||
{
|
||||
public CompileResult Compile(string filepath, string fileName)
|
||||
{
|
||||
ConsoleIO.WriteLogLine($"Starting compilation...");
|
||||
|
||||
using var peStream = new MemoryStream();
|
||||
var result = GenerateCode(filepath, fileName).Emit(peStream);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
ConsoleIO.WriteLogLine("Compilation done with error.");
|
||||
|
||||
var failures = result.Diagnostics.Where(diagnostic => diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error);
|
||||
|
||||
return new CompileResult()
|
||||
|
|
@ -41,9 +37,7 @@ namespace DynamicRun.Builder
|
|||
Failures = failures.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
ConsoleIO.WriteLogLine("Compilation done without any error.");
|
||||
|
||||
|
||||
peStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return new CompileResult()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue