diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 061721b0..a148bee3 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -14,8 +14,18 @@ public static class AppConfig static AppConfig() { + string startupPath = Application.StartupPath.Trim('\\'); string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper"; - configFile = appPath + "\\config.json"; + string configName = "\\config.json"; + + if (File.Exists(startupPath + configName)) + { + configFile = startupPath + configName; + } else + { + configFile = appPath + configName; + } + if (!System.IO.Directory.Exists(appPath)) System.IO.Directory.CreateDirectory(appPath); diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 30ab929b..1f12a432 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ AnyCPU False True - 0.85 + 0.86 diff --git a/app/NativeMethods.cs b/app/NativeMethods.cs index 32f4e546..36d26f55 100644 --- a/app/NativeMethods.cs +++ b/app/NativeMethods.cs @@ -804,9 +804,25 @@ public class NativeMethods public static void SetPowerScheme(string scheme) { - PowerSetActiveScheme(IntPtr.Zero, new Guid(scheme)); - PowerSetActiveOverlayScheme(new Guid(scheme)); - Logger.WriteLine(scheme); + List overlays = new() { + "00000000-0000-0000-0000-000000000000", + "ded574b5-45a0-4f42-8737-46345c09c238", + "961cc777-2547-4f9d-8174-7d86181b8a7a", + "3af9B8d9-7c97-431d-ad78-34a8bfea439f" + }; + + if (overlays.Contains(scheme)) + { + PowerSetActiveOverlayScheme(new Guid(scheme)); + Logger.WriteLine("Power mode:" + scheme); + } + else + { + PowerSetActiveScheme(IntPtr.Zero, new Guid(scheme)); + Logger.WriteLine("Power plan:" + scheme); + } + + } public static void SetPowerScheme(int mode)