AI Pettorali

This commit is contained in:
MaddoScientisto 2026-05-09 17:27:05 +02:00
commit cb41c42bb5
11 changed files with 379 additions and 55 deletions

View file

@ -38,6 +38,8 @@ static class Program
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GenerateConsoleCtrlEvent(uint dwCtrlEvent, uint dwProcessGroupId);
@ -85,10 +87,18 @@ static class Program
.LogToTrace();
[STAThread]
static void Main(string[] args)
static int Main(string[] args)
{
#if WINDOWS
AllocConsole();
if (CommandLineOperationRunner.IsHeadlessRequest(args))
{
AttachConsole(ATTACH_PARENT_PROCESS);
}
else
{
AllocConsole();
}
RedirectConsoleOutput();
#endif
@ -97,7 +107,15 @@ static class Program
ServiceProvider = serviceCollection.BuildServiceProvider();
if (CommandLineOperationRunner.IsHeadlessRequest(args))
{
return CommandLineOperationRunner.RunAsync(ServiceProvider, args ?? Array.Empty<string>())
.GetAwaiter()
.GetResult();
}
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args ?? Array.Empty<string>());
return 0;
}
private static void ConfigureServices(ServiceCollection services)