mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Power modes fix
This commit is contained in:
@@ -14,8 +14,18 @@ public static class AppConfig
|
|||||||
static AppConfig()
|
static AppConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string startupPath = Application.StartupPath.Trim('\\');
|
||||||
string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
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))
|
if (!System.IO.Directory.Exists(appPath))
|
||||||
System.IO.Directory.CreateDirectory(appPath);
|
System.IO.Directory.CreateDirectory(appPath);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.85</AssemblyVersion>
|
<AssemblyVersion>0.86</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -804,9 +804,25 @@ public class NativeMethods
|
|||||||
|
|
||||||
public static void SetPowerScheme(string scheme)
|
public static void SetPowerScheme(string scheme)
|
||||||
{
|
{
|
||||||
PowerSetActiveScheme(IntPtr.Zero, new Guid(scheme));
|
List<string> overlays = new() {
|
||||||
PowerSetActiveOverlayScheme(new Guid(scheme));
|
"00000000-0000-0000-0000-000000000000",
|
||||||
Logger.WriteLine(scheme);
|
"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)
|
public static void SetPowerScheme(int mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user