mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added automatic GPU mode switching, battery charge limit setting, startup scheduling
This commit is contained in:
@@ -2,30 +2,32 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<StartupObject>Program</StartupObject>
|
||||
<StartupObject>GHelper.Program</StartupObject>
|
||||
<ApplicationIcon>Resources\standard.ico</ApplicationIcon>
|
||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="MMC20">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<Guid>8e80422b-cac4-472b-b272-9635f1dfef3b</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<None Remove="Resources\eco.ico" />
|
||||
<None Remove="Resources\icons8-charging-battery-48.png" />
|
||||
<None Remove="Resources\icons8-laptop-48.png" />
|
||||
<None Remove="Resources\icons8-speed-48.png" />
|
||||
<None Remove="Resources\icons8-video-card-48.png" />
|
||||
<None Remove="Resources\ultimate.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\standard.ico" />
|
||||
<Content Include="Resources\standard.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -43,4 +45,52 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\eco.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-charging-battery-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-laptop-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-speed-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-video-card-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ultimate.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
304
Program.cs
304
Program.cs
@@ -1,19 +1,9 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using System.Management;
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
using GHelper;
|
||||
using System.Dynamic;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
public class ASUSWmi
|
||||
{
|
||||
@@ -28,6 +18,7 @@ public class ASUSWmi
|
||||
public const int GPUEco = 0x00090020;
|
||||
public const int GPUMux = 0x00090016;
|
||||
|
||||
public const int BatteryLimit = 0x00120057;
|
||||
|
||||
public const int PerformanceBalanced = 0;
|
||||
public const int PerformanceTurbo = 1;
|
||||
@@ -90,17 +81,64 @@ public class ASUSWmi
|
||||
|
||||
}
|
||||
|
||||
public class Startup
|
||||
{
|
||||
|
||||
static string taskName = "GSharpHelper";
|
||||
|
||||
public Startup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool IsScheduled()
|
||||
{
|
||||
TaskService taskService = new TaskService();
|
||||
return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName));
|
||||
}
|
||||
|
||||
public void Schedule()
|
||||
{
|
||||
TaskService taskService = new TaskService();
|
||||
|
||||
string strExeFilePath = Application.ExecutablePath;
|
||||
|
||||
if (strExeFilePath is null) return;
|
||||
|
||||
Debug.WriteLine(strExeFilePath);
|
||||
TaskDefinition td = TaskService.Instance.NewTask();
|
||||
td.RegistrationInfo.Description = "GSharpHelper Auto Start";
|
||||
|
||||
LogonTrigger lt = new LogonTrigger();
|
||||
td.Triggers.Add(lt);
|
||||
td.Actions.Add(strExeFilePath);
|
||||
td.Principal.RunLevel = TaskRunLevel.Highest;
|
||||
td.Settings.StopIfGoingOnBatteries = false;
|
||||
td.Settings.DisallowStartIfOnBatteries = false;
|
||||
|
||||
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
||||
}
|
||||
|
||||
public void UnSchedule()
|
||||
{
|
||||
TaskService taskService = new TaskService();
|
||||
taskService.RootFolder.DeleteTask(taskName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
|
||||
string appPath;
|
||||
string configFile;
|
||||
|
||||
public dynamic Config = new ExpandoObject();
|
||||
public Dictionary<string, object> config = new Dictionary<string, object>();
|
||||
|
||||
public AppConfig() {
|
||||
public AppConfig()
|
||||
{
|
||||
|
||||
appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"\\GHelper";
|
||||
appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
||||
configFile = appPath + "\\config.json";
|
||||
|
||||
if (!System.IO.Directory.Exists(appPath))
|
||||
@@ -109,26 +147,36 @@ public class AppConfig
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
string text = File.ReadAllText(configFile);
|
||||
Config = JsonConvert.DeserializeObject<ExpandoObject>(text);
|
||||
} else
|
||||
config = JsonConvert.DeserializeObject<Dictionary<string, object>>(text);
|
||||
if (config is null)
|
||||
initConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
Config.performance_mode = 0;
|
||||
string jsonString = JsonConvert.SerializeObject(Config);
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
initConfig();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getConfig (string name)
|
||||
private void initConfig()
|
||||
{
|
||||
var propertyInfo = Config.GetType().GetProperty(name);
|
||||
return propertyInfo.GetValue(Config, null);
|
||||
config = new Dictionary<string, object>();
|
||||
config["performance_mode"] = 0;
|
||||
string jsonString = JsonConvert.SerializeObject(config);
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
}
|
||||
|
||||
public int getConfig(string name)
|
||||
{
|
||||
if (config.ContainsKey(name))
|
||||
return int.Parse(config[name].ToString());
|
||||
else return -1;
|
||||
}
|
||||
|
||||
public void setConfig(string name, int value)
|
||||
{
|
||||
((IDictionary<String, Object>)Config).TryAdd(name, value);
|
||||
string jsonString = JsonConvert.SerializeObject(Config);
|
||||
config[name] = value;
|
||||
string jsonString = JsonConvert.SerializeObject(config);
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
}
|
||||
|
||||
@@ -136,124 +184,108 @@ public class AppConfig
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class Program
|
||||
namespace GHelper
|
||||
{
|
||||
public static NotifyIcon trayIcon;
|
||||
|
||||
public static ASUSWmi wmi;
|
||||
public static AppConfig config;
|
||||
|
||||
public static SettingsForm settingsForm;
|
||||
|
||||
// The main entry point for the application
|
||||
public static void Main()
|
||||
static class Program
|
||||
{
|
||||
trayIcon = new NotifyIcon
|
||||
public static NotifyIcon trayIcon;
|
||||
|
||||
public static ASUSWmi wmi;
|
||||
public static AppConfig config;
|
||||
|
||||
public static SettingsForm settingsForm;
|
||||
public static Startup scheduler;
|
||||
|
||||
// The main entry point for the application
|
||||
public static void Main()
|
||||
{
|
||||
Text = "G14 Helper",
|
||||
Icon = new System.Drawing.Icon("Resources/standard.ico"),
|
||||
Visible = true
|
||||
};
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||
|
||||
config = new AppConfig();
|
||||
|
||||
wmi = new ASUSWmi();
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
settingsForm = new SettingsForm();
|
||||
//settingsForm.Show();
|
||||
|
||||
int GpuMode = GetGPUMode();
|
||||
|
||||
settingsForm.SetPerformanceMode();
|
||||
settingsForm.VisualiseGPUMode(GpuMode);
|
||||
|
||||
settingsForm.FormClosed += SettingsForm_FormClosed;
|
||||
|
||||
Application.Run();
|
||||
|
||||
}
|
||||
|
||||
public static int GetGPUMode ()
|
||||
{
|
||||
|
||||
int eco = wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
int GpuMode;
|
||||
|
||||
if (mux == 0)
|
||||
GpuMode = ASUSWmi.GPUModeUltimate;
|
||||
else
|
||||
{
|
||||
if (eco == 1)
|
||||
GpuMode = ASUSWmi.GPUModeEco;
|
||||
else
|
||||
GpuMode = ASUSWmi.GPUModeStandard;
|
||||
|
||||
if (mux != 1)
|
||||
settingsForm.Disable_Ultimate();
|
||||
}
|
||||
|
||||
config.setConfig ("gpu_mode",GpuMode);
|
||||
|
||||
return GpuMode;
|
||||
|
||||
}
|
||||
|
||||
private static void SettingsForm_FormClosed(object? sender, FormClosedEventArgs e)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
var collection = (ManagementEventWatcher)sender;
|
||||
int EventID = int.Parse(e.NewEvent["EventID"].ToString());
|
||||
|
||||
Debug.WriteLine(EventID);
|
||||
|
||||
switch (EventID)
|
||||
{
|
||||
case 56:
|
||||
case 174:
|
||||
CyclePerformanceMode();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (settingsForm.Visible)
|
||||
settingsForm.Hide(); else
|
||||
trayIcon = new NotifyIcon
|
||||
{
|
||||
settingsForm.Show();
|
||||
settingsForm.Activate();
|
||||
Text = "G14 Helper",
|
||||
Icon = GHelper.Properties.Resources.standard,
|
||||
Visible = true
|
||||
};
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||
|
||||
config = new AppConfig();
|
||||
|
||||
wmi = new ASUSWmi();
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
scheduler = new Startup();
|
||||
|
||||
settingsForm = new SettingsForm();
|
||||
|
||||
settingsForm.InitGPUMode();
|
||||
|
||||
settingsForm.SetPerformanceMode(config.getConfig("performance_mode"));
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
|
||||
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
||||
settingsForm.SetStartupCheck(scheduler.IsScheduled());
|
||||
|
||||
Application.Run();
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
var collection = (ManagementEventWatcher)sender;
|
||||
int EventID = int.Parse(e.NewEvent["EventID"].ToString());
|
||||
|
||||
Debug.WriteLine(EventID);
|
||||
|
||||
switch (EventID)
|
||||
{
|
||||
case 56: // Rog button
|
||||
case 174: // FN+F5
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.CyclePerformanceMode();
|
||||
});
|
||||
return;
|
||||
case 87: // Battery
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.AutoGPUMode(0);
|
||||
});
|
||||
return;
|
||||
case 88: // Plugged
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.AutoGPUMode(1);
|
||||
});
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (settingsForm.Visible)
|
||||
settingsForm.Hide();
|
||||
else
|
||||
{
|
||||
settingsForm.Show();
|
||||
settingsForm.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CyclePerformanceMode()
|
||||
{
|
||||
settingsForm.BeginInvoke(delegate
|
||||
|
||||
static void OnExit(object sender, EventArgs e)
|
||||
{
|
||||
settingsForm.SetPerformanceMode(config.getConfig("performance_mode") + 1);
|
||||
});
|
||||
trayIcon.Visible = false;
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
static void OnExit(object sender, EventArgs e)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
123
Properties/Resources.Designer.cs
generated
Normal file
123
Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,123 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GHelper.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GHelper.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon eco {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("eco", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_charging_battery_48 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-charging-battery-48", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_speed_48 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-speed-48", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_video_card_48 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-video-card-48", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon standard {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("standard", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon ultimate {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ultimate", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
139
Properties/Resources.resx
Normal file
139
Properties/Resources.resx
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
26
Properties/Settings.Designer.cs
generated
Normal file
26
Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GHelper.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Properties/Settings.settings
Normal file
6
Properties/Settings.settings
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
</SettingsFile>
|
||||
48
README.md
48
README.md
@@ -1 +1,47 @@
|
||||
# GHelper
|
||||
# G14-Helper
|
||||
|
||||
Designed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models.
|
||||
|
||||
A tiny system tray utility that allows you set performance and GPU profiles for your laptop. Same as ASUS Armory Crate does but without it completely!.
|
||||
|
||||
## Performance Profile switching
|
||||
|
||||
Profiles are **same** as in Armory Crate, including default fan curves
|
||||
|
||||
1. Silent (minimal or no fans, 45W PPT to CPU)
|
||||
2. Balanced (balanced fans, up to 45W PPT to CPU)
|
||||
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU)
|
||||
|
||||
## GPU Mode switching
|
||||
|
||||
1. Eco mode : only low power iGPU (Radeon 680u) enabled, iGPU drives built in display
|
||||
2. Standard mode (Windows Hybrid) : iGPU and dGPU (Radeon 6700s/6800s) enabled, iGPU drives built in display
|
||||
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display
|
||||
|
||||
## Extras
|
||||
|
||||
1. **Maximum battery charge rate** limit (60% / 80% / 100%) to preserve your battery
|
||||
2. CPU and GPU relative fan speed monitoring
|
||||
3. Automatic switching of Standard/Eco GPU modes when laptop is plugged / unplugged!
|
||||
4. Start with windows (optional)
|
||||
|
||||
|
||||
## How to install
|
||||
|
||||
1. Download latest release from https://github.com/seerge/g14-helper/releases
|
||||
2. Unzip to a folder of your choice
|
||||
3. Run **GHelper.exe**
|
||||
|
||||
Note: Uses low level ASUS WMI commands to do switching and doens't require Armory Crate to be isntalled at all.
|
||||
Therefore requires Administrator priveledges on Windows to run.
|
||||
|
||||
I don`t have Microsoft certificate to sign app yet, so if you set a warning from Windows Defender on launch (Windows Protected your PC), click More Info -> Run anyway.
|
||||
|
||||
Alternatively you can comile and run project by yourself :)
|
||||
|
||||

|
||||
|
||||
Settings are located in APPDATA\ROAMING
|
||||
|
||||
P.S.: It's not recommended to use app in combination with Armory Crate, cause they adjust same settings.
|
||||
Please keep in mind, that if you also run MyASUS app periodically it will also try to adjust same battery charge settings
|
||||
|
||||
383
Settings.Designer.cs
generated
383
Settings.Designer.cs
generated
@@ -28,129 +28,106 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupPerf = new System.Windows.Forms.GroupBox();
|
||||
this.labelCPUFan = new System.Windows.Forms.Label();
|
||||
this.tablePerf = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonTurbo = new System.Windows.Forms.Button();
|
||||
this.buttonBalanced = new System.Windows.Forms.Button();
|
||||
this.buttonSilent = new System.Windows.Forms.Button();
|
||||
this.groupGPU = new System.Windows.Forms.GroupBox();
|
||||
this.checkStartup = new System.Windows.Forms.CheckBox();
|
||||
this.trackBattery = new System.Windows.Forms.TrackBar();
|
||||
this.labelBattery = new System.Windows.Forms.Label();
|
||||
this.labelBatteryLimit = new System.Windows.Forms.Label();
|
||||
this.pictureBattery = new System.Windows.Forms.PictureBox();
|
||||
this.labelGPUFan = new System.Windows.Forms.Label();
|
||||
this.tableGPU = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonUltimate = new System.Windows.Forms.Button();
|
||||
this.buttonStandard = new System.Windows.Forms.Button();
|
||||
this.buttonEco = new System.Windows.Forms.Button();
|
||||
this.groupPerf.SuspendLayout();
|
||||
this.tablePerf.SuspendLayout();
|
||||
this.groupGPU.SuspendLayout();
|
||||
this.labelGPU = new System.Windows.Forms.Label();
|
||||
this.pictureGPU = new System.Windows.Forms.PictureBox();
|
||||
this.labelCPUFan = new System.Windows.Forms.Label();
|
||||
this.tablePerf = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonTurbo = new System.Windows.Forms.Button();
|
||||
this.buttonBalanced = new System.Windows.Forms.Button();
|
||||
this.buttonSilent = new System.Windows.Forms.Button();
|
||||
this.picturePerf = new System.Windows.Forms.PictureBox();
|
||||
this.labelPerf = new System.Windows.Forms.Label();
|
||||
this.checkGPU = new System.Windows.Forms.CheckBox();
|
||||
this.buttonQuit = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
|
||||
this.tableGPU.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureGPU)).BeginInit();
|
||||
this.tablePerf.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picturePerf)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupPerf
|
||||
// checkStartup
|
||||
//
|
||||
this.groupPerf.Controls.Add(this.labelCPUFan);
|
||||
this.groupPerf.Controls.Add(this.tablePerf);
|
||||
this.groupPerf.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupPerf.Location = new System.Drawing.Point(10, 10);
|
||||
this.groupPerf.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.groupPerf.Name = "groupPerf";
|
||||
this.groupPerf.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.groupPerf.Size = new System.Drawing.Size(666, 188);
|
||||
this.groupPerf.TabIndex = 0;
|
||||
this.groupPerf.TabStop = false;
|
||||
this.groupPerf.Text = "Performance Mode";
|
||||
this.checkStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.checkStartup.AutoSize = true;
|
||||
this.checkStartup.Location = new System.Drawing.Point(34, 640);
|
||||
this.checkStartup.Name = "checkStartup";
|
||||
this.checkStartup.Size = new System.Drawing.Size(206, 36);
|
||||
this.checkStartup.TabIndex = 2;
|
||||
this.checkStartup.Text = "Run on Startup";
|
||||
this.checkStartup.UseVisualStyleBackColor = true;
|
||||
this.checkStartup.CheckedChanged += new System.EventHandler(this.checkStartup_CheckedChanged);
|
||||
//
|
||||
// labelCPUFan
|
||||
// trackBattery
|
||||
//
|
||||
this.labelCPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelCPUFan.AutoSize = true;
|
||||
this.labelCPUFan.Location = new System.Drawing.Point(491, 28);
|
||||
this.labelCPUFan.Name = "labelCPUFan";
|
||||
this.labelCPUFan.Size = new System.Drawing.Size(154, 32);
|
||||
this.labelCPUFan.TabIndex = 2;
|
||||
this.labelCPUFan.Text = "CPU Fan : 0%";
|
||||
this.trackBattery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.trackBattery.LargeChange = 20;
|
||||
this.trackBattery.Location = new System.Drawing.Point(23, 532);
|
||||
this.trackBattery.Maximum = 100;
|
||||
this.trackBattery.Minimum = 50;
|
||||
this.trackBattery.Name = "trackBattery";
|
||||
this.trackBattery.Size = new System.Drawing.Size(702, 90);
|
||||
this.trackBattery.SmallChange = 10;
|
||||
this.trackBattery.TabIndex = 3;
|
||||
this.trackBattery.TickFrequency = 10;
|
||||
this.trackBattery.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
||||
this.trackBattery.Value = 100;
|
||||
//
|
||||
// tablePerf
|
||||
// labelBattery
|
||||
//
|
||||
this.tablePerf.ColumnCount = 3;
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.Controls.Add(this.buttonTurbo, 2, 0);
|
||||
this.tablePerf.Controls.Add(this.buttonBalanced, 1, 0);
|
||||
this.tablePerf.Controls.Add(this.buttonSilent, 0, 0);
|
||||
this.tablePerf.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tablePerf.Location = new System.Drawing.Point(10, 72);
|
||||
this.tablePerf.Name = "tablePerf";
|
||||
this.tablePerf.RowCount = 1;
|
||||
this.tablePerf.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 106F));
|
||||
this.tablePerf.Size = new System.Drawing.Size(646, 106);
|
||||
this.tablePerf.TabIndex = 0;
|
||||
this.labelBattery.AutoSize = true;
|
||||
this.labelBattery.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.labelBattery.Location = new System.Drawing.Point(83, 486);
|
||||
this.labelBattery.Name = "labelBattery";
|
||||
this.labelBattery.Size = new System.Drawing.Size(248, 32);
|
||||
this.labelBattery.TabIndex = 4;
|
||||
this.labelBattery.Text = "Battery Charge Limit";
|
||||
//
|
||||
// buttonTurbo
|
||||
// labelBatteryLimit
|
||||
//
|
||||
this.buttonTurbo.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonTurbo.FlatAppearance.BorderSize = 0;
|
||||
this.buttonTurbo.Location = new System.Drawing.Point(440, 10);
|
||||
this.buttonTurbo.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonTurbo.Name = "buttonTurbo";
|
||||
this.buttonTurbo.Size = new System.Drawing.Size(196, 86);
|
||||
this.buttonTurbo.TabIndex = 2;
|
||||
this.buttonTurbo.Text = "Turbo";
|
||||
this.buttonTurbo.UseVisualStyleBackColor = true;
|
||||
this.labelBatteryLimit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelBatteryLimit.AutoSize = true;
|
||||
this.labelBatteryLimit.Location = new System.Drawing.Point(647, 484);
|
||||
this.labelBatteryLimit.Name = "labelBatteryLimit";
|
||||
this.labelBatteryLimit.Size = new System.Drawing.Size(73, 32);
|
||||
this.labelBatteryLimit.TabIndex = 5;
|
||||
this.labelBatteryLimit.Text = "100%";
|
||||
//
|
||||
// buttonBalanced
|
||||
// pictureBattery
|
||||
//
|
||||
this.buttonBalanced.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.buttonBalanced.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonBalanced.FlatAppearance.BorderSize = 0;
|
||||
this.buttonBalanced.Location = new System.Drawing.Point(225, 10);
|
||||
this.buttonBalanced.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonBalanced.Name = "buttonBalanced";
|
||||
this.buttonBalanced.Size = new System.Drawing.Size(195, 86);
|
||||
this.buttonBalanced.TabIndex = 1;
|
||||
this.buttonBalanced.Text = "Balanced";
|
||||
this.buttonBalanced.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonSilent
|
||||
//
|
||||
this.buttonSilent.CausesValidation = false;
|
||||
this.buttonSilent.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonSilent.FlatAppearance.BorderSize = 0;
|
||||
this.buttonSilent.Location = new System.Drawing.Point(10, 10);
|
||||
this.buttonSilent.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonSilent.Name = "buttonSilent";
|
||||
this.buttonSilent.Size = new System.Drawing.Size(195, 86);
|
||||
this.buttonSilent.TabIndex = 0;
|
||||
this.buttonSilent.Text = "Silent";
|
||||
this.buttonSilent.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupGPU
|
||||
//
|
||||
this.groupGPU.Controls.Add(this.labelGPUFan);
|
||||
this.groupGPU.Controls.Add(this.tableGPU);
|
||||
this.groupGPU.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupGPU.Location = new System.Drawing.Point(10, 198);
|
||||
this.groupGPU.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.groupGPU.Name = "groupGPU";
|
||||
this.groupGPU.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.groupGPU.Size = new System.Drawing.Size(666, 188);
|
||||
this.groupGPU.TabIndex = 1;
|
||||
this.groupGPU.TabStop = false;
|
||||
this.groupGPU.Text = "GPU Mode";
|
||||
this.pictureBattery.Image = global::GHelper.Properties.Resources.icons8_charging_battery_48;
|
||||
this.pictureBattery.Location = new System.Drawing.Point(32, 478);
|
||||
this.pictureBattery.Name = "pictureBattery";
|
||||
this.pictureBattery.Size = new System.Drawing.Size(48, 48);
|
||||
this.pictureBattery.TabIndex = 6;
|
||||
this.pictureBattery.TabStop = false;
|
||||
//
|
||||
// labelGPUFan
|
||||
//
|
||||
this.labelGPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelGPUFan.AutoSize = true;
|
||||
this.labelGPUFan.Location = new System.Drawing.Point(491, 33);
|
||||
this.labelGPUFan.Location = new System.Drawing.Point(566, 242);
|
||||
this.labelGPUFan.Name = "labelGPUFan";
|
||||
this.labelGPUFan.Size = new System.Drawing.Size(155, 32);
|
||||
this.labelGPUFan.TabIndex = 3;
|
||||
this.labelGPUFan.TabIndex = 8;
|
||||
this.labelGPUFan.Text = "GPU Fan : 0%";
|
||||
//
|
||||
// tableGPU
|
||||
//
|
||||
this.tableGPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tableGPU.ColumnCount = 3;
|
||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
@@ -158,59 +135,210 @@
|
||||
this.tableGPU.Controls.Add(this.buttonUltimate, 2, 0);
|
||||
this.tableGPU.Controls.Add(this.buttonStandard, 1, 0);
|
||||
this.tableGPU.Controls.Add(this.buttonEco, 0, 0);
|
||||
this.tableGPU.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tableGPU.Location = new System.Drawing.Point(10, 72);
|
||||
this.tableGPU.Location = new System.Drawing.Point(23, 289);
|
||||
this.tableGPU.Name = "tableGPU";
|
||||
this.tableGPU.RowCount = 1;
|
||||
this.tableGPU.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 106F));
|
||||
this.tableGPU.Size = new System.Drawing.Size(646, 106);
|
||||
this.tableGPU.TabIndex = 0;
|
||||
this.tableGPU.Size = new System.Drawing.Size(702, 106);
|
||||
this.tableGPU.TabIndex = 7;
|
||||
//
|
||||
// buttonUltimate
|
||||
//
|
||||
this.buttonUltimate.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonUltimate.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonUltimate.FlatAppearance.BorderSize = 0;
|
||||
this.buttonUltimate.Location = new System.Drawing.Point(440, 10);
|
||||
this.buttonUltimate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonUltimate.Location = new System.Drawing.Point(478, 10);
|
||||
this.buttonUltimate.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonUltimate.Name = "buttonUltimate";
|
||||
this.buttonUltimate.Size = new System.Drawing.Size(196, 86);
|
||||
this.buttonUltimate.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonUltimate.TabIndex = 2;
|
||||
this.buttonUltimate.Text = "Ultimate";
|
||||
this.buttonUltimate.UseVisualStyleBackColor = true;
|
||||
this.buttonUltimate.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonStandard
|
||||
//
|
||||
this.buttonStandard.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.buttonStandard.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonStandard.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonStandard.FlatAppearance.BorderSize = 0;
|
||||
this.buttonStandard.Location = new System.Drawing.Point(225, 10);
|
||||
this.buttonStandard.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonStandard.Location = new System.Drawing.Point(244, 10);
|
||||
this.buttonStandard.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonStandard.Name = "buttonStandard";
|
||||
this.buttonStandard.Size = new System.Drawing.Size(195, 86);
|
||||
this.buttonStandard.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonStandard.TabIndex = 1;
|
||||
this.buttonStandard.Text = "Standard";
|
||||
this.buttonStandard.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonEco
|
||||
//
|
||||
this.buttonEco.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonEco.CausesValidation = false;
|
||||
this.buttonEco.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonEco.FlatAppearance.BorderSize = 0;
|
||||
this.buttonEco.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonEco.Location = new System.Drawing.Point(10, 10);
|
||||
this.buttonEco.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonEco.Name = "buttonEco";
|
||||
this.buttonEco.Size = new System.Drawing.Size(195, 86);
|
||||
this.buttonEco.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonEco.TabIndex = 0;
|
||||
this.buttonEco.Text = "Eco";
|
||||
this.buttonEco.UseVisualStyleBackColor = true;
|
||||
this.buttonEco.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// labelGPU
|
||||
//
|
||||
this.labelGPU.AutoSize = true;
|
||||
this.labelGPU.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.labelGPU.Location = new System.Drawing.Point(82, 242);
|
||||
this.labelGPU.Name = "labelGPU";
|
||||
this.labelGPU.Size = new System.Drawing.Size(136, 32);
|
||||
this.labelGPU.TabIndex = 9;
|
||||
this.labelGPU.Text = "GPU Mode";
|
||||
//
|
||||
// pictureGPU
|
||||
//
|
||||
this.pictureGPU.Image = global::GHelper.Properties.Resources.icons8_video_card_48;
|
||||
this.pictureGPU.Location = new System.Drawing.Point(29, 234);
|
||||
this.pictureGPU.Name = "pictureGPU";
|
||||
this.pictureGPU.Size = new System.Drawing.Size(48, 48);
|
||||
this.pictureGPU.TabIndex = 10;
|
||||
this.pictureGPU.TabStop = false;
|
||||
//
|
||||
// labelCPUFan
|
||||
//
|
||||
this.labelCPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelCPUFan.AutoSize = true;
|
||||
this.labelCPUFan.Location = new System.Drawing.Point(568, 39);
|
||||
this.labelCPUFan.Name = "labelCPUFan";
|
||||
this.labelCPUFan.Size = new System.Drawing.Size(154, 32);
|
||||
this.labelCPUFan.TabIndex = 12;
|
||||
this.labelCPUFan.Text = "CPU Fan : 0%";
|
||||
//
|
||||
// tablePerf
|
||||
//
|
||||
this.tablePerf.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tablePerf.ColumnCount = 3;
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tablePerf.Controls.Add(this.buttonTurbo, 2, 0);
|
||||
this.tablePerf.Controls.Add(this.buttonBalanced, 1, 0);
|
||||
this.tablePerf.Controls.Add(this.buttonSilent, 0, 0);
|
||||
this.tablePerf.Location = new System.Drawing.Point(23, 90);
|
||||
this.tablePerf.Name = "tablePerf";
|
||||
this.tablePerf.RowCount = 1;
|
||||
this.tablePerf.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 106F));
|
||||
this.tablePerf.Size = new System.Drawing.Size(702, 106);
|
||||
this.tablePerf.TabIndex = 11;
|
||||
//
|
||||
// buttonTurbo
|
||||
//
|
||||
this.buttonTurbo.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonTurbo.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonTurbo.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
||||
this.buttonTurbo.FlatAppearance.BorderSize = 0;
|
||||
this.buttonTurbo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonTurbo.Location = new System.Drawing.Point(478, 10);
|
||||
this.buttonTurbo.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonTurbo.Name = "buttonTurbo";
|
||||
this.buttonTurbo.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonTurbo.TabIndex = 2;
|
||||
this.buttonTurbo.Text = "Turbo";
|
||||
this.buttonTurbo.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonBalanced
|
||||
//
|
||||
this.buttonBalanced.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonBalanced.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonBalanced.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
|
||||
this.buttonBalanced.FlatAppearance.BorderSize = 0;
|
||||
this.buttonBalanced.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonBalanced.Location = new System.Drawing.Point(244, 10);
|
||||
this.buttonBalanced.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonBalanced.Name = "buttonBalanced";
|
||||
this.buttonBalanced.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonBalanced.TabIndex = 1;
|
||||
this.buttonBalanced.Text = "Balanced";
|
||||
this.buttonBalanced.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonSilent
|
||||
//
|
||||
this.buttonSilent.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonSilent.CausesValidation = false;
|
||||
this.buttonSilent.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonSilent.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
|
||||
this.buttonSilent.FlatAppearance.BorderSize = 0;
|
||||
this.buttonSilent.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonSilent.Location = new System.Drawing.Point(10, 10);
|
||||
this.buttonSilent.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.buttonSilent.Name = "buttonSilent";
|
||||
this.buttonSilent.Size = new System.Drawing.Size(214, 86);
|
||||
this.buttonSilent.TabIndex = 0;
|
||||
this.buttonSilent.Text = "Silent";
|
||||
this.buttonSilent.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// picturePerf
|
||||
//
|
||||
this.picturePerf.Image = global::GHelper.Properties.Resources.icons8_speed_48;
|
||||
this.picturePerf.Location = new System.Drawing.Point(30, 29);
|
||||
this.picturePerf.Name = "picturePerf";
|
||||
this.picturePerf.Size = new System.Drawing.Size(48, 48);
|
||||
this.picturePerf.TabIndex = 14;
|
||||
this.picturePerf.TabStop = false;
|
||||
//
|
||||
// labelPerf
|
||||
//
|
||||
this.labelPerf.AutoSize = true;
|
||||
this.labelPerf.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.labelPerf.Location = new System.Drawing.Point(83, 37);
|
||||
this.labelPerf.Name = "labelPerf";
|
||||
this.labelPerf.Size = new System.Drawing.Size(234, 32);
|
||||
this.labelPerf.TabIndex = 13;
|
||||
this.labelPerf.Text = "Performance Mode";
|
||||
//
|
||||
// checkGPU
|
||||
//
|
||||
this.checkGPU.AutoSize = true;
|
||||
this.checkGPU.Location = new System.Drawing.Point(34, 400);
|
||||
this.checkGPU.Name = "checkGPU";
|
||||
this.checkGPU.Size = new System.Drawing.Size(614, 36);
|
||||
this.checkGPU.TabIndex = 15;
|
||||
this.checkGPU.Text = "Switch to Eco on battery and Standard when plugged";
|
||||
this.checkGPU.UseVisualStyleBackColor = true;
|
||||
this.checkGPU.CheckedChanged += new System.EventHandler(this.checkGPU_CheckedChanged);
|
||||
//
|
||||
// buttonQuit
|
||||
//
|
||||
this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonQuit.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.buttonQuit.Location = new System.Drawing.Point(602, 634);
|
||||
this.buttonQuit.Name = "buttonQuit";
|
||||
this.buttonQuit.Size = new System.Drawing.Size(120, 46);
|
||||
this.buttonQuit.TabIndex = 16;
|
||||
this.buttonQuit.Text = "Quit";
|
||||
this.buttonQuit.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(686, 636);
|
||||
this.Controls.Add(this.groupGPU);
|
||||
this.Controls.Add(this.groupPerf);
|
||||
this.ClientSize = new System.Drawing.Size(756, 704);
|
||||
this.Controls.Add(this.buttonQuit);
|
||||
this.Controls.Add(this.checkGPU);
|
||||
this.Controls.Add(this.picturePerf);
|
||||
this.Controls.Add(this.labelPerf);
|
||||
this.Controls.Add(this.labelCPUFan);
|
||||
this.Controls.Add(this.tablePerf);
|
||||
this.Controls.Add(this.pictureGPU);
|
||||
this.Controls.Add(this.labelGPU);
|
||||
this.Controls.Add(this.labelGPUFan);
|
||||
this.Controls.Add(this.tableGPU);
|
||||
this.Controls.Add(this.pictureBattery);
|
||||
this.Controls.Add(this.labelBatteryLimit);
|
||||
this.Controls.Add(this.labelBattery);
|
||||
this.Controls.Add(this.trackBattery);
|
||||
this.Controls.Add(this.checkStartup);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MdiChildrenMinimizedAnchorBottom = false;
|
||||
@@ -222,29 +350,38 @@
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "G14 Helper";
|
||||
this.Load += new System.EventHandler(this.Settings_Load);
|
||||
this.groupPerf.ResumeLayout(false);
|
||||
this.groupPerf.PerformLayout();
|
||||
this.tablePerf.ResumeLayout(false);
|
||||
this.groupGPU.ResumeLayout(false);
|
||||
this.groupGPU.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).EndInit();
|
||||
this.tableGPU.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureGPU)).EndInit();
|
||||
this.tablePerf.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.picturePerf)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupPerf;
|
||||
private TableLayoutPanel tablePerf;
|
||||
private Button buttonSilent;
|
||||
private Button buttonTurbo;
|
||||
private Button buttonBalanced;
|
||||
private GroupBox groupGPU;
|
||||
private CheckBox checkStartup;
|
||||
private TrackBar trackBattery;
|
||||
private Label labelBattery;
|
||||
private Label labelBatteryLimit;
|
||||
private PictureBox pictureBattery;
|
||||
private Label labelGPUFan;
|
||||
private TableLayoutPanel tableGPU;
|
||||
private Button buttonUltimate;
|
||||
private Button buttonStandard;
|
||||
private Button buttonEco;
|
||||
private Label labelGPU;
|
||||
private PictureBox pictureGPU;
|
||||
private Label labelCPUFan;
|
||||
private Label labelGPUFan;
|
||||
private TableLayoutPanel tablePerf;
|
||||
private Button buttonTurbo;
|
||||
private Button buttonBalanced;
|
||||
private Button buttonSilent;
|
||||
private PictureBox picturePerf;
|
||||
private Label labelPerf;
|
||||
private CheckBox checkGPU;
|
||||
private Button buttonQuit;
|
||||
}
|
||||
}
|
||||
242
Settings.cs
242
Settings.cs
@@ -1,32 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using Windows.ApplicationModel.Store;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
|
||||
static Color colorActive = Color.LightGray;
|
||||
static Color colorEco = Color.FromArgb(255, 6, 180, 138);
|
||||
static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
|
||||
static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
|
||||
|
||||
static System.Timers.Timer aTimer;
|
||||
static int buttonInactive = 0;
|
||||
static int buttonActive = 5;
|
||||
|
||||
static System.Timers.Timer aTimer = default!;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
FormClosing += SettingsForm_FormClosing;
|
||||
|
||||
buttonSilent.FlatAppearance.BorderColor = colorEco;
|
||||
buttonBalanced.FlatAppearance.BorderColor = colorStandard;
|
||||
buttonTurbo.FlatAppearance.BorderColor = colorTurbo;
|
||||
|
||||
buttonEco.FlatAppearance.BorderColor = colorEco;
|
||||
buttonStandard.FlatAppearance.BorderColor = colorStandard;
|
||||
buttonUltimate.FlatAppearance.BorderColor = colorTurbo;
|
||||
|
||||
buttonSilent.Click += ButtonSilent_Click;
|
||||
buttonBalanced.Click += ButtonBalanced_Click;
|
||||
buttonTurbo.Click += ButtonTurbo_Click;
|
||||
@@ -37,11 +41,31 @@ namespace GHelper
|
||||
|
||||
VisibleChanged += SettingsForm_VisibleChanged;
|
||||
|
||||
trackBattery.Scroll += trackBatteryChange;
|
||||
|
||||
buttonQuit.Click += ButtonQuit_Click;
|
||||
|
||||
SetTimer();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ButtonQuit_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
Program.trayIcon.Visible = false;
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void SettingsForm_FormClosing(object? sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (e.CloseReason == CloseReason.UserClosing)
|
||||
{
|
||||
e.Cancel = true;
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUltimate_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetGPUMode(ASUSWmi.GPUModeUltimate);
|
||||
@@ -66,8 +90,8 @@ namespace GHelper
|
||||
|
||||
private static void OnTimedEvent(Object source, ElapsedEventArgs e)
|
||||
{
|
||||
var cpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan)/0.6);
|
||||
var gpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan)/0.6);
|
||||
var cpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6);
|
||||
var gpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6);
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
@@ -85,7 +109,8 @@ namespace GHelper
|
||||
this.Top = Screen.FromControl(this).Bounds.Height - 100 - this.Height;
|
||||
this.Activate();
|
||||
aTimer.Enabled = true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
@@ -94,24 +119,23 @@ namespace GHelper
|
||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced)
|
||||
{
|
||||
|
||||
buttonSilent.UseVisualStyleBackColor = true;
|
||||
buttonBalanced.UseVisualStyleBackColor = true;
|
||||
buttonTurbo.UseVisualStyleBackColor = true;
|
||||
|
||||
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
||||
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
||||
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
||||
|
||||
switch (PerformanceMode)
|
||||
{
|
||||
case ASUSWmi.PerformanceSilent:
|
||||
buttonSilent.BackColor = colorActive;
|
||||
groupPerf.Text = "Peformance Mode: Silent";
|
||||
buttonSilent.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Silent";
|
||||
break;
|
||||
case ASUSWmi.PerformanceTurbo:
|
||||
buttonTurbo.BackColor = colorActive;
|
||||
groupPerf.Text = "Peformance Mode: Turbo";
|
||||
buttonTurbo.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Turbo";
|
||||
break;
|
||||
default:
|
||||
buttonBalanced.BackColor = colorActive;
|
||||
groupPerf.Text = "Peformance Mode: Balanced";
|
||||
buttonBalanced.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Balanced";
|
||||
PerformanceMode = ASUSWmi.PerformanceBalanced;
|
||||
break;
|
||||
}
|
||||
@@ -123,6 +147,75 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
public void CyclePerformanceMode()
|
||||
{
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1);
|
||||
}
|
||||
|
||||
public void AutoGPUMode(int Plugged = 1)
|
||||
{
|
||||
|
||||
int GpuAuto = Program.config.getConfig("gpu_auto");
|
||||
if (GpuAuto != 1) return;
|
||||
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
int GPUMode;
|
||||
|
||||
if (mux == 0) // GPU in Ultimate, ignore
|
||||
return;
|
||||
else
|
||||
{
|
||||
if (eco == 1 && Plugged == 1) // Eco going Standard on plugged
|
||||
{
|
||||
GPUMode = ASUSWmi.GPUModeStandard;
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
||||
Program.config.setConfig("gpu_mode", GPUMode);
|
||||
}
|
||||
else if (eco == 0 && Plugged == 0) // Standard going Eco on plugged
|
||||
{
|
||||
GPUMode = ASUSWmi.GPUModeEco;
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
||||
Program.config.setConfig("gpu_mode", GPUMode);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int InitGPUMode()
|
||||
{
|
||||
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
int GpuMode;
|
||||
|
||||
if (mux == 0)
|
||||
GpuMode = ASUSWmi.GPUModeUltimate;
|
||||
else
|
||||
{
|
||||
if (eco == 1)
|
||||
GpuMode = ASUSWmi.GPUModeEco;
|
||||
else
|
||||
GpuMode = ASUSWmi.GPUModeStandard;
|
||||
|
||||
if (mux != 1)
|
||||
Disable_Ultimate();
|
||||
}
|
||||
|
||||
Program.config.setConfig("gpu_mode", GpuMode);
|
||||
VisualiseGPUMode(GpuMode);
|
||||
|
||||
return GpuMode;
|
||||
|
||||
}
|
||||
|
||||
public void SetGPUMode(int GPUMode = ASUSWmi.GPUModeStandard)
|
||||
{
|
||||
|
||||
@@ -143,7 +236,8 @@ namespace GHelper
|
||||
restart = true;
|
||||
changed = true;
|
||||
}
|
||||
} else if (GPUMode == ASUSWmi.GPUModeUltimate)
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeUltimate)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show(" Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
@@ -153,12 +247,14 @@ namespace GHelper
|
||||
changed = true;
|
||||
}
|
||||
|
||||
} else if (GPUMode == ASUSWmi.GPUModeEco)
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeEco)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
||||
changed = true;
|
||||
} else if (GPUMode == ASUSWmi.GPUModeStandard)
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeStandard)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
||||
@@ -176,34 +272,42 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
public void VisualiseGPUMode (int GPUMode)
|
||||
|
||||
public void VisualiseGPUAuto(int GPUAuto)
|
||||
{
|
||||
checkGPU.Checked = (GPUAuto == 1);
|
||||
}
|
||||
|
||||
public void VisualiseGPUMode(int GPUMode)
|
||||
{
|
||||
|
||||
buttonEco.UseVisualStyleBackColor = true;
|
||||
buttonStandard.UseVisualStyleBackColor = true;
|
||||
buttonUltimate.UseVisualStyleBackColor = true;
|
||||
|
||||
buttonEco.FlatAppearance.BorderSize = buttonInactive;
|
||||
buttonStandard.FlatAppearance.BorderSize = buttonInactive;
|
||||
buttonUltimate.FlatAppearance.BorderSize = buttonInactive;
|
||||
|
||||
switch (GPUMode)
|
||||
{
|
||||
case ASUSWmi.GPUModeEco:
|
||||
buttonEco.BackColor = colorActive;
|
||||
groupGPU.Text = "GPU Mode: Eco (iGPU only)";
|
||||
Program.trayIcon.Icon = new System.Drawing.Icon("Resources/eco.ico");
|
||||
buttonEco.FlatAppearance.BorderSize = buttonActive;
|
||||
labelGPU.Text = "GPU Mode: Eco (iGPU only)";
|
||||
Program.trayIcon.Icon = GHelper.Properties.Resources.eco;
|
||||
break;
|
||||
case ASUSWmi.GPUModeUltimate:
|
||||
buttonUltimate.BackColor = colorActive;
|
||||
groupGPU.Text = "GPU Mode: Ultimate (dGPU exclusive)";
|
||||
Program.trayIcon.Icon = new System.Drawing.Icon("Resources/ultimate.ico");
|
||||
buttonUltimate.FlatAppearance.BorderSize = buttonActive;
|
||||
labelGPU.Text = "GPU Mode: Ultimate (dGPU exclusive)";
|
||||
Program.trayIcon.Icon = GHelper.Properties.Resources.ultimate;
|
||||
break;
|
||||
default:
|
||||
buttonStandard.BackColor = colorActive;
|
||||
groupGPU.Text = "GPU Mode: Eco (iGPU and dGPU)";
|
||||
Program.trayIcon.Icon = new System.Drawing.Icon("Resources/standard.ico");
|
||||
buttonStandard.FlatAppearance.BorderSize = buttonActive;
|
||||
labelGPU.Text = "GPU Mode: Eco (iGPU and dGPU)";
|
||||
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void ButtonSilent_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetPerformanceMode(ASUSWmi.PerformanceSilent);
|
||||
@@ -226,7 +330,55 @@ namespace GHelper
|
||||
|
||||
public void Disable_Ultimate()
|
||||
{
|
||||
buttonUltimate.Enabled= false;
|
||||
buttonUltimate.Enabled = false;
|
||||
}
|
||||
|
||||
public void SetStartupCheck(bool status)
|
||||
{
|
||||
checkStartup.Checked = status;
|
||||
}
|
||||
private void checkStartup_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
{
|
||||
Program.scheduler.Schedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.scheduler.UnSchedule();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBatteryChargeLimit (int limit = 100)
|
||||
{
|
||||
|
||||
if (limit < 50 || limit > 100) limit = 100;
|
||||
|
||||
labelBatteryLimit.Text = limit.ToString() + "%";
|
||||
trackBattery.Value = limit;
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||
Program.config.setConfig("charge_limit", limit);
|
||||
|
||||
}
|
||||
|
||||
private void trackBatteryChange(object sender, EventArgs e)
|
||||
{
|
||||
TrackBar bar = (TrackBar)sender;
|
||||
SetBatteryChargeLimit(bar.Value);
|
||||
}
|
||||
|
||||
private void checkGPU_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
{
|
||||
Program.config.setConfig("gpu_auto", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.config.setConfig("gpu_auto", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1
old-ps1-script/ghelper-compile.ps1
Normal file
1
old-ps1-script/ghelper-compile.ps1
Normal file
@@ -0,0 +1 @@
|
||||
ps2exe .\ghelper.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput
|
||||
687
old-ps1-script/ghelper.ps1
Normal file
687
old-ps1-script/ghelper.ps1
Normal file
File diff suppressed because one or more lines are too long
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 490 KiB |
Reference in New Issue
Block a user