참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1,43 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
var codeSnippetsPath = args[args.Length - 1];
var codeSnippets = JsonSerializer.Deserialize<List<CodeSnippet>>(File.ReadAllText(codeSnippetsPath));
if (codeSnippets == null)
{
Console.WriteLine("Error: codeSnippets is null");
return;
}
var output = new List<object>();
foreach (var codeSnippet in codeSnippets)
{
var tree = CSharpSyntaxTree.ParseText(codeSnippet.code);
var syntaxErrors = tree.GetDiagnostics()
.Where(diag => diag.Severity == DiagnosticSeverity.Error)
.ToList();
if (syntaxErrors.Any())
{
output.Add(new
{
status = "error",
error = string.Join("\n", syntaxErrors.Select(diag => diag.GetMessage()))
});
}
else
{
output.Add(new
{
status = "ok"
});
}
}
Console.WriteLine(JsonSerializer.Serialize(output));
record CodeSnippet(string filePath, string codeLang, string code);