added console

This commit is contained in:
Boki 2026-02-13 13:18:29 -05:00
parent bb8e75a2f5
commit dab5735c80
3 changed files with 45 additions and 3 deletions

View file

@ -1,3 +1,4 @@
using System.Runtime.InteropServices;
using Avalonia;
using Poe2Trade.Core;
@ -5,9 +6,15 @@ namespace Poe2Trade.Ui;
class Program
{
[DllImport("kernel32.dll")]
private static extern bool AttachConsole(int dwProcessId);
[STAThread]
public static void Main(string[] args)
{
AttachConsole(-1); // ATTACH_PARENT_PROCESS — reuse the launching terminal
Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true });
Console.SetError(new StreamWriter(Console.OpenStandardError()) { AutoFlush = true });
Logging.Setup();
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}