feat: move the "--debug" option from ui to global

and process it manualy
This commit is contained in:
2026-04-01 10:16:41 +03:00
parent bbf233d14c
commit 498a8619ab
2 changed files with 44 additions and 41 deletions
+2 -33
View File
@@ -24,52 +24,21 @@ public partial class Program
{
var builder = BuildAvaloniaApp();
var fullscreen = parseResult.GetValue(_fullscreen);
var debug = parseResult.GetValue(_debug);
var renderingMode = parseResult.GetValue(_renderingMode);
var hideConsole = parseResult.GetValue(_hideConsole);
IsFullscreen = fullscreen;
#if DEBUG
if (debug && !System.Diagnostics.Debugger.IsAttached)
{
bool keepWaiting = true;
void CancelHandle(object? sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
keepWaiting = false;
Console.WriteLine("\nWait cancelled by user.");
Environment.Exit(0);
}
Console.CancelKeyPress += CancelHandle;
Console.WriteLine("Waiting debugger attach (Press Ctrl+C to cancel)");
Console.WriteLine($"Process Id: {Environment.ProcessId}");
Console.WriteLine($"Process Name: {Environment.ProcessPath}");
Console.WriteLine($"Thread Id: {Thread.CurrentThread.ManagedThreadId}");
Console.WriteLine($"Thread Name: {Thread.CurrentThread.Name}");
while (!System.Diagnostics.Debugger.IsAttached && keepWaiting)
Thread.Sleep(100);
if (System.Diagnostics.Debugger.IsAttached)
System.Diagnostics.Debugger.Break();
Console.CancelKeyPress -= CancelHandle;
}
#endif
if (hideConsole)
SilenceConsole();
switch (renderingMode)
{
case RenderingMode.X11:
builder.StartWithClassicDesktopLifetime(_args ?? []);
builder.StartWithClassicDesktopLifetime(_args?.ToArray() ?? []);
break;
case RenderingMode.DRM:
builder.StartLinuxDrm(_args ?? [], "/dev/dri/card1", 1.0);
builder.StartLinuxDrm(_args?.ToArray() ?? [], "/dev/dri/card1", 1.0);
break;
}
}