From 99d3c618978474d4cd88821ed2aabe91ca76e2e0 Mon Sep 17 00:00:00 2001 From: seerge Date: Wed, 15 Mar 2023 21:25:49 +0100 Subject: [PATCH] Kill app on Eco switch --- ASUSWmi.cs | 10 ++++------ NativeMethods.cs | 5 +---- Settings.cs | 6 ++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ASUSWmi.cs b/ASUSWmi.cs index 690fdae7..8aa5be34 100644 --- a/ASUSWmi.cs +++ b/ASUSWmi.cs @@ -1,6 +1,4 @@ -using GHelper; -using System.Diagnostics; -using System.Management; +using System.Management; using System.Runtime.InteropServices; @@ -35,8 +33,8 @@ public class ASUSWmi public const int PPT_CPUB0 = 0x001200B0; // CPU PPT on 2022 public const int PPT_CPUB1 = 0x001200B1; // APU PPT on 2022 - public const int PPT_APUC1 = 0x001200C1; - public const int PPT_APUC2 = 0x001200C2; + public const int PPT_APUC1 = 0x001200C1; + public const int PPT_APUC2 = 0x001200C2; public const int PerformanceBalanced = 0; public const int PerformanceTurbo = 1; @@ -187,7 +185,7 @@ public class ASUSWmi if (curve.Length != 16) return; if (curve.All(singleByte => singleByte == 0)) return; - Logger.WriteLine("Fans" + ((device == 1)?"GPU":"CPU") + " " + BitConverter.ToString(curve)); + Logger.WriteLine("Fans" + ((device == 1) ? "GPU" : "CPU") + " " + BitConverter.ToString(curve)); if (device == 1) DeviceSet(DevsGPUFanCurve, curve); diff --git a/NativeMethods.cs b/NativeMethods.cs index e937756a..01c2c9cb 100644 --- a/NativeMethods.cs +++ b/NativeMethods.cs @@ -1,10 +1,7 @@ -using System.Collections; -using System; -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; using static Tools.ScreenInterrogatory; -using System.Windows.Forms; namespace Tools { diff --git a/Settings.cs b/Settings.cs index 1d629f06..bfdd7a77 100644 --- a/Settings.cs +++ b/Settings.cs @@ -940,6 +940,12 @@ namespace GHelper new Thread(() => { Thread.CurrentThread.IsBackground = true; + + if (eco == 1) + { + foreach (var process in Process.GetProcessesByName("EADesktop")) process.Kill(); + } + Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco); Program.settingsForm.BeginInvoke(delegate {