From 26c0aa775767708ed0a62f31310df44d62cf284f Mon Sep 17 00:00:00 2001 From: pixeltris <6952411+pixeltris@users.noreply.github.com> Date: Fri, 13 Nov 2020 15:56:34 +0000 Subject: [PATCH] Fix GUI mode check --- GK6X/GK6X-gui.bat | 2 +- GK6X/Program.cs | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/GK6X/GK6X-gui.bat b/GK6X/GK6X-gui.bat index 143979b..f2f7935 100644 --- a/GK6X/GK6X-gui.bat +++ b/GK6X/GK6X-gui.bat @@ -1 +1 @@ -call %WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe GK6X.csproj /p:Configuration=Debug /p:OutputType=Winexe /p:AssemblyName=GK6X-gui \ No newline at end of file +call %WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe GK6X.csproj /p:Configuration=Debug /p:OutputType=Winexe /p:AssemblyName=GK6X-gui /p:DefineConstants=AS_GUI \ No newline at end of file diff --git a/GK6X/Program.cs b/GK6X/Program.cs index c6d8bae..fb0bc69 100644 --- a/GK6X/Program.cs +++ b/GK6X/Program.cs @@ -16,7 +16,11 @@ class Program static void Main(string[] args) { +#if AS_GUI + Run(asGUI: true); +#else Run(asGUI: false); +#endif Stop(); } @@ -36,17 +40,6 @@ static void Stop() static void Run(bool asGUI) { - try - { - if (Process.GetCurrentProcess().MainWindowHandle == IntPtr.Zero) - { - asGUI = true; - } - } - catch - { - } - BasePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); DataBasePath = Path.Combine(BasePath, DataBasePath); UserDataPath = Path.Combine(BasePath, UserDataPath);