From ef314ac2273d1ffd3eed5bdcdaedc81f008f9a96 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 9 Aug 2024 15:37:36 +0200 Subject: [PATCH] show console on cmd --- ModpackUpdater.Manager/Extensions.cs | 2 +- ModpackUpdater/ModpackUpdater.csproj | 2 +- ModpackUpdater/Program.cs | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ModpackUpdater.Manager/Extensions.cs b/ModpackUpdater.Manager/Extensions.cs index 61e6d00..49b53e9 100644 --- a/ModpackUpdater.Manager/Extensions.cs +++ b/ModpackUpdater.Manager/Extensions.cs @@ -6,7 +6,7 @@ public static class Extensions { public static bool IsSide(this Side @this, Side side) { - return @this.HasFlag(side) || side.HasFlag(@this); + return @this.HasFlag(side); } diff --git a/ModpackUpdater/ModpackUpdater.csproj b/ModpackUpdater/ModpackUpdater.csproj index b49617c..53d4492 100644 --- a/ModpackUpdater/ModpackUpdater.csproj +++ b/ModpackUpdater/ModpackUpdater.csproj @@ -1,7 +1,7 @@  - WinExe + Exe net8.0-windows true icons8_download_from_ftp.ico diff --git a/ModpackUpdater/Program.cs b/ModpackUpdater/Program.cs index ff07925..e863a91 100644 --- a/ModpackUpdater/Program.cs +++ b/ModpackUpdater/Program.cs @@ -2,6 +2,7 @@ using ModpackUpdater.Model; using Newtonsoft.Json; using Pilz.Configuration; +using System.Runtime.InteropServices; using Telerik.WinControls; namespace ModpackUpdater; @@ -12,6 +13,12 @@ public static class Program public static ISettings Settings => settingsManager.Instance; + [DllImport("kernel32.dll")] + static extern IntPtr GetConsoleWindow(); + + [DllImport("user32.dll")] + static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + static Program() { settingsManager = new(GetSettingsPath(2), true); @@ -25,7 +32,10 @@ public static class Program if (options.NoUi) InstallWithoutGui(options.UpdateOptions, options.Silent); else + { + ShowWindow(GetConsoleWindow(), 0); RunApp(options.UpdateOptions); + } } private static void RunApp(UpdateCheckOptionsAdv updateOptions)