diff --git a/GHelper.csproj b/GHelper.csproj index e6ddf7ee..f5399a20 100644 --- a/GHelper.csproj +++ b/GHelper.csproj @@ -2,30 +2,32 @@ WinExe - net6.0-windows10.0.22621.0 + net6.0-windows8.0 enable - true + True enable True app.manifest - Program + GHelper.Program Resources\standard.ico + 8.0 - - tlbimp - 0 - 1 - 8e80422b-cac4-472b-b272-9635f1dfef3b - 0 - false - true - + + + + + + + + - + + Always + @@ -43,4 +45,52 @@ + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + True + True + Resources.resx + + + True + True + Settings.settings + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + \ No newline at end of file diff --git a/Program.cs b/Program.cs index a408c652..e9a3deb7 100644 --- a/Program.cs +++ b/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 config = new Dictionary(); - public AppConfig() { - - appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"\\GHelper"; + public AppConfig() + { + + 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(text); - } else + config = JsonConvert.DeserializeObject>(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(); + 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)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(); - } -} - +} \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 00000000..5058f380 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace GHelper.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon eco { + get { + object obj = ResourceManager.GetObject("eco", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_charging_battery_48 { + get { + object obj = ResourceManager.GetObject("icons8-charging-battery-48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_speed_48 { + get { + object obj = ResourceManager.GetObject("icons8-speed-48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_video_card_48 { + get { + object obj = ResourceManager.GetObject("icons8-video-card-48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon standard { + get { + object obj = ResourceManager.GetObject("standard", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon ultimate { + get { + object obj = ResourceManager.GetObject("ultimate", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 00000000..b22caba5 --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 00000000..e59bfd1c --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 00000000..049245f4 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,6 @@ + + + + + + diff --git a/README.md b/README.md index a666a1d3..895ee2b4 100644 --- a/README.md +++ b/README.md @@ -1 +1,47 @@ -# GHelper \ No newline at end of file +# 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 :) + +![Screenshot](https://github.com/seerge/g14-helper/blob/main/screenshot.png) + +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 diff --git a/Settings.Designer.cs b/Settings.Designer.cs index a5993c9d..9917c984 100644 --- a/Settings.Designer.cs +++ b/Settings.Designer.cs @@ -28,129 +28,106 @@ /// 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; } } \ No newline at end of file diff --git a/Settings.cs b/Settings.cs index fd52652f..d56ff040 100644 --- a/Settings.cs +++ b/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,9 +41,29 @@ namespace GHelper VisibleChanged += SettingsForm_VisibleChanged; - SetTimer(); - + 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) @@ -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,12 +147,81 @@ 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) - { + { int CurrentGPU = Program.config.getConfig("gpu_mode"); - if (CurrentGPU == GPUMode) + if (CurrentGPU == GPUMode) return; var restart = false; @@ -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,10 +330,58 @@ 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); + } + } + + } diff --git a/old-ps1-script/ghelper-compile.ps1 b/old-ps1-script/ghelper-compile.ps1 new file mode 100644 index 00000000..2a1349be --- /dev/null +++ b/old-ps1-script/ghelper-compile.ps1 @@ -0,0 +1 @@ +ps2exe .\ghelper.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput \ No newline at end of file diff --git a/old-ps1-script/ghelper.ps1 b/old-ps1-script/ghelper.ps1 new file mode 100644 index 00000000..c9b21263 --- /dev/null +++ b/old-ps1-script/ghelper.ps1 @@ -0,0 +1,687 @@ +# Self-elevate the script +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine -WindowStyle Hidden + Exit + } +} + +# DPI Awareness +Add-Type -TypeDefinition @' +using System.Runtime.InteropServices; +public class ProcessDPI { + [DllImport("user32.dll", SetLastError=true)] + public static extern bool SetProcessDPIAware(); +} +'@ +$null = [ProcessDPI]::SetProcessDPIAware() +#[System.Windows.Forms.Application]::EnableVisualStyles() + +Add-Type -AssemblyName PresentationFramework +Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName System.Drawing +Add-Type -AssemblyName WindowsFormsIntegration + +function SetAutostart () { + $taskName = "G14Helper" + $task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue + if ($null -ne $task) {return } + + if ([System.IO.Path]::GetExtension($PSCommandPath) -eq '.ps1') { + $action = New-ScheduledTaskAction -Execute "powershell" -Argument "-WindowStyle Hidden -File $PSCommandPath" + } else { + $psScriptPath = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName + $action = New-ScheduledTaskAction -Execute $psScriptPath + } + + $trigger = New-ScheduledTaskTrigger -AtLogon + $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries + + $principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest + $definition = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings -Description "Run $($taskName) at Logon" + + Register-ScheduledTask -TaskName $taskName -InputObject $definition + SaveConfigSetting -Name 'autostart' -Value 1 +} + +function CheckAutostart () { + $task = Get-ScheduledTask -TaskName "G14Helper" -ErrorAction SilentlyContinue + $Menu_Autostart.Checked = ($null -ne $task) +} + +function DisableAutostart () { + Unregister-ScheduledTask -TaskName "G14Helper" -Confirm:$false + SaveConfigSetting -Name 'autostart' -Value 0 +} + +function Set-ScreenRefreshRate +{ + param ( + [Parameter(Mandatory=$true)] + [int] $Frequency + ) + + $pinvokeCode = @" + using System; + using System.Runtime.InteropServices; + + namespace Display + { + [StructLayout(LayoutKind.Sequential)] + public struct DEVMODE1 + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmDeviceName; + public short dmSpecVersion; + public short dmDriverVersion; + public short dmSize; + public short dmDriverExtra; + public int dmFields; + + public short dmOrientation; + public short dmPaperSize; + public short dmPaperLength; + public short dmPaperWidth; + + public short dmScale; + public short dmCopies; + public short dmDefaultSource; + public short dmPrintQuality; + public short dmColor; + public short dmDuplex; + public short dmYResolution; + public short dmTTOption; + public short dmCollate; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmFormName; + public short dmLogPixels; + public short dmBitsPerPel; + public int dmPelsWidth; + public int dmPelsHeight; + + public int dmDisplayFlags; + public int dmDisplayFrequency; + + public int dmICMMethod; + public int dmICMIntent; + public int dmMediaType; + public int dmDitherType; + public int dmReserved1; + public int dmReserved2; + + public int dmPanningWidth; + public int dmPanningHeight; + }; + + class User_32 + { + [DllImport("user32.dll")] + public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode); + [DllImport("user32.dll")] + public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags); + + public const int ENUM_CURRENT_SETTINGS = -1; + public const int CDS_UPDATEREGISTRY = 0x01; + public const int CDS_TEST = 0x02; + public const int DISP_CHANGE_SUCCESSFUL = 0; + public const int DISP_CHANGE_RESTART = 1; + public const int DISP_CHANGE_FAILED = -1; + } + + public class PrimaryScreen + { + static public string ChangeRefreshRate(int frequency) + { + DEVMODE1 dm = new DEVMODE1(); + + if (0 != User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm)) + { + dm.dmDisplayFrequency = frequency; + + int iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST); + + if (iRet == User_32.DISP_CHANGE_FAILED) + { + return "Unable to process your request. Sorry for this inconvenience."; + } + else + { + iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY); + switch (iRet) + { + case User_32.DISP_CHANGE_SUCCESSFUL: + { + return "Success"; + } + case User_32.DISP_CHANGE_RESTART: + { + return "You need to reboot for the change to happen.\n If you feel any problems after rebooting your machine\nThen try to change resolution in Safe Mode."; + } + default: + { + return "Failed to change the resolution"; + } + } + } + } + else + { + return "Failed to change the resolution."; + } + } + + + } + } +"@ # don't indend this line + + Add-Type $pinvokeCode + [Display.PrimaryScreen]::ChangeRefreshRate($frequency) +} + + +function isLaptopScreenMain { + Add-Type -AssemblyName System.Windows.Forms + $name = [System.Windows.Forms.Screen]::PrimaryScreen | Select-Object -ExpandProperty "DeviceName" + if ($name -eq "\\.\DISPLAY1") { + return $true + } +} + +function Get-ScreenRefreshRate +{ + $frequency = Get-WmiObject -Class "Win32_VideoController" | Select-Object -ExpandProperty "CurrentRefreshRate" + return $frequency +} + + +# Some fancy icons in base64 +$icon_eco = [Drawing.Icon][IO.MemoryStream][Convert]::FromBase64String("AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAACQAABMLAAATCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACKtAYAirQGAIq0BgCKtAYAirQGAIq0BgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+sAAAs8EUAIizBgaKswYfirQGQ4q0BmaKtAaHirQGm4q0BqaKtAamirQGnYq0BoiKtAZoirQGQ4mzBh2IswUGssIWAH6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+JtAX/iLMD/4u1CP+SuRj/m78q/6LEOf+jxDv/nL8s/5S6G/+MtQr/iLMD/4m0Bf+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BqeIswYOibQGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACJswQAjbUMAIq0BmWKtAb3irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4mzA/+SuRb/rstS/9Dhm//m78r/8vfk//b57f/3+u3/8/jm/+nx0f/U5KT/tc9h/5W7Hv+JswT/irQF/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BviKtAZnjLgFAIixBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACKswUAirMFIoq0BtOKtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+JtAX/jLUK/63KUP/h7L//+/z2/////////////////////////////////////////////f76/+fwzP+50mr/kbgU/4mzBP+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAbUibMGI4mzBgAAAAAAAAAAAAAAAAAAAAAAAAAAAIayAwCMtgkAirQGe4q0Bv6KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4m0Bf+PtxH/xNqD//f67v////////////////////////////7+/f/+/vz////////////////////////////8/fn/2Oat/5zALP+JswT/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQGfYu0CwCLtQMAAAAAAAAAAAAAAAAAAAAAAIq0BQCKtAUbirQG0oq0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQF/4+3EP/K3Y7//P35//////////////////P35v/Z56//w9mA/7jRZ/+20GT/v9Z3/9Tjo//v9dz//v79/////////////////+Tuxf+ewTD/ibME/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG1Im0BR2KtAUAAAAAAAAAAAAAAAAAhbIDAIu0BgCKtAZdirQG+4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/i7QH/8DXef/8/fj////////////6/PT/0eGc/6HCNv+Ntg3/ibMD/4izAv+IswL/iLMC/4y1Cf+avif/wdd7//D13//////////////////h7L//lrwh/4mzBP+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG+4mzBmCKtAYAi7IDAAAAAAAAAAAAibMFAIizBQWKtAamirQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+JswP/psZC//T45/////////////j67/+81HD/jbYM/4mzA/+KtAX/irQG/4q0Bv+KtAb/irQG/4q0Bv+JswT/ibQE/6TEPf/k7sb/////////////////yt2P/4y1Cf+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BqiJswQGibMFAAAAAAAAAAAAirMFAIqzBR2KtAbYirQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bf+Otg7/1+aq/////////////f77/8LYfv+LtQj/irQF/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4izAv+fwTL/6/LU////////////9fnq/6TFPv+JswP/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BtqJtAYfirQGAAAAAAAAAAAAirQGAIq0BUOKtAb0irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4mzA/+lxT//9/ru////////////4Ou8/5K5GP+JtAT/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+JswT/ss5c//r88////////////8vdkP+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BvSKtAZDirQGAAAAAAAAAAAAirQGAIq0BmiKtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4mzBP/E2YH////////////8/fn/s85c/4izAv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQF/4q0Bf+KtAX/irQF/4q0Bf+JtAT/jrcP/9vos////////////+jwz/+Uuhv/ibQF/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAZlirQGAAAAAAAAAAAAirYHAIq0BoiKtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQF/463D//c6bX////////////t89j/l7wi/4mzBP+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bf+KtAX/jbYN/463Dv+Otw7/jrcO/463Dv+Otg7/jLYL/73Vc//+//7///////f67v+kxT3/ibMD/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAaHi7QHAAAAAAAAAAAAh7kJAIq0Bp2KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/ibQF/5S6G//p8dH////////////W5aj/jLUL/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQF/422Df+602z/2uix/9votP/b6LP/2+iz/9vos//b6LP/2+iy/+XvyP/+/vz///////3++v+xzVn/iLMC/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAabi7YJAAAAAAAAAAAAYb0vAIq0BqaKtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/ibME/5e8Iv/x9uD////////////G24b/ibMD/4q0Bv+KtAb/irQG/4q0Bv+KtAb/ibMD/6TFPv/2+ev///////////////////////////////////////////////////////////+40Wf/iLMB/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAamiMACAAAAAAAAAAAAXMAyAIq0BqaKtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/ibME/5e8Iv/x9uH////////////E2YL/iLMC/4q0Bv+KtAb/irQG/4q0Bv+KtAb/ibMD/6PEOv/1+er///////////////////////////////////////////////////////v89v+uy1L/iLMC/4q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AAAAirMFAIqzBR+KtAbairQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+Mtgv/0+Oh/////////////P36/8PZf/+LtQn/ibQF/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4mzBP+cwCz/tc9h/5/CNP+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BtiJswUdibMFAAAAAAAAAAAAirMFAImzBAaKtAaoirQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+JswP/pMQ9//L34/////////////j78f/B2Hz/kLgS/4izA/+KtAX/irQG/4q0Bv+KtAb/irQG/4q0Bv+JswT/irQH/67LUv/r8tT////+/+vy1P+cvyz/ibME/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0BqaKswUFirMFAAAAAAAAAAAAhbIDAIu0BgCKswZgirQG+4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/7zUcP/7/Pf////////////7/ff/2Oas/6fHQ/+PtxD/ibME/4izAv+IswL/iLMC/4u1CP+YvSP/xNmB//X56/////////////r89f+pyEj/iLMC/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG+4q0Bl2KtAYAjLIDAAAAAAAAAAAAAAAAAIq0BQCKswUdirQG1Iq0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQF/462Dv/H24f//P34//////////////////f67v/e6rn/xdqE/7jSaf+20GP/vdVz/9Hhnf/s89f//v78/////////////////9zptf+TuRj/ibQF/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG0om0BRuKtAUAAAAAAAAAAAAAAAAAAAAAAImxAwCMuwsAirMGfoq0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4q0Bv+KtAb/irQG/4m0Bf+Otw//wNd6//X46f////////////////////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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO+vNwDvticA7646I++uOn7vrjrV7646+u+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646+u+uOtLvrjp87606Ie+mNAHvqzgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADpqzoA8K45AO+uOQ/vrjpn76461e+uOv7vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr976460++uOmXvrToM7646AO+rOgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO+sOQDvsjsA7646J++uOqfvrjr47646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvfvrjql7646J++qOwDvrzoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7Ks4APq5PwDvrTo97646zO+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646zu+uOj/vvUEA76s4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADtrDkA87I8AO6tOkTvrjrZ7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOtrvrTpE77I8AO+sOQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO+sNwDurzwA7646P++uOtrvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjrZ7606Pe+vOwDvqjgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7K0/AO+uOQDvrjko7646ze+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7604/++tOP/vrTj/7604/++uOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646zO+uOifvrjkA760/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7605AO+tOQzvrjql7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7603/++vO//wtEj/8bpW//K/Yv/yv2T/8bpY//C1Sv/vrz3/7603/++uOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOqfwrjoO8K46AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvqzgA8LY/AO+uOmXvrjr37646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/ws0f/9Md3//nesP/87tX//fbq//758P/++fH//ffs//zw2v/54bf/9cyC//G2Tf/vrTj/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvjvrjpn7607AO+uOQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvrTkA7605Iu+uOtPvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7689//TGdf/76s3//vz4//////////////////////////////////////////////37//zu1//1z4n/8LNF/++tOP/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjrU8K46I/CuOgAAAAAAAAAAAAAAAAAAAAAAAAAAAO+qNwDvsTsA7646e++uOv7vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOf/wsUP/99ad//758v/////////////////////////////+/f///v3//////////////////////////////fr/+uS+//G6WP/vrTj/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646feeuOQDzrjoAAAAAAAAAAAAAAAAAAAAAAO+tOQDvrTob76460u+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7645//CxQv/42qb///36//////////////////336//65cD/99aa//XOh//1zYT/9tOU//nhtv/99OT///79//////////////////vs0f/yu1v/7604/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/76461O+uOR3wrjoAAAAAAAAAAAAAAAAA76k3AO+uOgDvrjpd7646+++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7647//bTlf///fr////////////++/b/+d+x//K+YP/vsD//7604/++tN//vrTf/7603/++vPf/xuVT/99SW//315v/////////////////76sz/8bdP/++tOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646+++uOmDvrjoA7683AAAAAAAAAAAA7q06AO6sOQXvrjqm7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTj/88Fp//337P////////////768v/20I7/77A//++tOP/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTj/7645//PAZf/77NL/////////////////+Nun/++vPf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOqjurjkG7q46AAAAAAAAAAAA7q46AO6uOh3vrjrY7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/wsUD/+uO8//////////////77//fVmf/vrzv/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tN//yvF3//PHd/////////////vjv//PAZv/vrTj/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOtrwrjof8K46AAAAAAAAAAAA7646AO+uOkPvrjr07646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/zwWf//vnx////////////++nK//C0SP/vrTn/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTj/9cp+//779v////////////jbp//vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvTvrjpD7646AAAAAAAAAAAA8K46AO+uOmjvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/31pz//////////////fv/9cp+/++tN//vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOf/vrjn/7645/++uOf/vrTn/8LFB//rmw/////////////zv2f/wtUv/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjpl7646AAAAAAAAAAAA8a86AO+uOojvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7645//CxQf/658X////////////88uD/8bdQ/++tOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/77BA//CxQf/wsUH/8LFB//CxQf/wsUH/77A+//bRkP////7///////758v/zwGb/7604/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqH7646AAAAAAAAAAAA768+AO+uOp3vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7645//C1S//88Nv////////////547r/768+/++uOv/vrjr/7646/++uOv/vrjr/7646/++wP//2z4v/+ubB//rmw//65sP/+ubD//rmw//65sP/+ubC//zt1P///v3////////9+//0yXz/7603/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqb7687AAAAAAAAAAAA76xFAO+uOqbvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7605//G3UP/99ef////////////32KD/7604/++uOv/vrjr/7646/++uOv/vrjr/7604//PAZv/++O/////////////////////////////////////////////////////////////1zof/76w2/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqm76w4AAAAAAAAAAAA76xIAO+uOqbvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7605//G3UP/99ef////////////31pz/7603/++uOv/vrjr/7646/++uOv/vrjr/7604//K/Y//++O7///////////////////////////////////////////////////////78+P/0x3b/7603/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqm76w4AAAAAAAAAAAA7687AO+uOpvvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7645//C1Sv/88Nr////////////53rD/7687/++uOv/vrjr/7646/++uOv/vrjr/7646/++wP//1zYX/+eK5//rjvP/647v/+uO7//rju//647v/+uO7//rju//647z/+eO7//bRj//wskP/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqd7687AAAAAAAAAAAA8a86AO+uOofvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++wQP/65sL////////////77dP/8LNH/++uOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTn/7689/++wPv/vsD7/77A+/++wPv/vsD7/77A+/++wPv/vsD7/77A+/++uOf/vrjn/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjqI8K46AAAAAAAAAAAA8K46AO+uOmbvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/31Zn////////////++/X/9MVy/++tN//vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjpo8K46AAAAAAAAAAAA7646AO+uOkPvrjr07646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/ywGX//vnv////////////+ubD//CyRP/vrjn/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTj/7603/++tOP/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvTvrjpD7646AAAAAAAAAAAA7q46AO6tOh/vrjra7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vsD7/+eC1//////////////37//fVmv/vrzz/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOf/xuln/9cuC//K9Xv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOtjurTod7q06AAAAAAAAAAAA7q06AO6sOwbvrjqo7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrTj/88Bl//326f////////////779P/31Jf/8LJD/++tN//vrjn/7646/++uOv/vrjr/7646/++uOv/vrTj/7647//THdv/88d3////+//zx3f/xulj/7604/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOqburjkF7q46AAAAAAAAAAAA76k9AO+uOgDvrjpg7646+++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646//bRjv/+/Pj//////////////fn/+uS9//PCa//wsUL/7604/++tN//vrTf/7603/++vPP/xt1H/99ab//747/////////////789//zw27/7603/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646+++uOl3vrjoA77A3AAAAAAAAAAAAAAAAAO6tOgDurTod76461O+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7645//CxQP/32KD///35//////////////////758v/76Mj/99ee//XOif/1zIT/9tKR//nfsf/88t////79//////////////////rnxf/wtEj/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/76460u+tOhvvrjkAAAAAAAAAAAAAAAAAAAAAAOurOAD3sj0A7646fu+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOf/wsUH/9tSV//747v/////////////////////////////+/f///vz////+/////////////////////////fv/+uW///G6V//vrTn/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr+7646e++tOwDvsDgAAAAAAAAAAAAAAAAAAAAAAAAAAADurjoA7q45JO+uOtXvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7647//PDbf/66Mf//vz4//////////////////////////////////////////////79//zx3f/20Y//8LNG/++tOP/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjrT7606Iu+uOgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvrjgA7648AO+uOmfvrjr47646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++tOP/ws0b/9MZ0//nesP/879j//vjt//768//++vT//vnw//zy3//647z/9c6H//G4Uf/vrTn/7645/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvfvrjpl765AAO+uOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7q46AO6uOg7vrjqn7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7603/++vPP/wtEn/8rxc//PBaf/zwmv/8r5g//G2Tv/vsD7/7603/++tOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOqXvrjkM7645AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA77BAAO+uOQDvrjon7646zO+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjn/7604/++tN//vrTf/7604/++tOf/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646ze+uOifvrzoA76Q9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOmqOADxsDsA7646Pe+uOtnvrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjra7646P+yuOAD0rjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvrToA77A6AO+uOkTvrjra7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOtnvrjpE77A6AO+tOgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA76w6AO+1OADvrjo/7646ze+uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646zO+uOj3vsjoA76w6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO+xOwDvozUA7646J++uOqXvrjr37646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOvjvrjqn7646J++wPQDvrDkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvsT0A7646AO+vOwzvrjpk76460++uOv3vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr/7646/++uOv/vrjr+76461e+uOmfvrjoP7646AO+xNwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO+vPADwr0EB7q06Ie+uOnzvrjrS7646+u+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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAP///////wAA//+AAf//AAD//AAAP/8AAP/4AAAP/wAA/+AAAAf/AAD/wAAAA/8AAP+AAAAB/wAA/wAAAAD/AAD+AAAAAH8AAPwAAAAAPwAA+AAAAAAfAAD4AAAAAB8AAPAAAAAADwAA8AAAAAAPAADgAAAAAAcAAOAAAAAABwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAOAAAAAABwAA4AAAAAAHAADwAAAAAA8AAPAAAAAADwAA+AAAAAAfAAD4AAAAAB8AAPwAAAAAPwAA/gAAAAB/AAD/AAAAAP8AAP+AAAAB/wAA/8AAAAP/AAD/4AAAB/8AAP/wAAAf/wAA//wAAD//AAD//4AB//8AAP///////wAA////////AAA=") +$icon_ultimate = [Drawing.Icon][IO.MemoryStream][Convert]::FromBase64String("AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAACQAABMLAAATCwAAAAAAAAAAAAAAAAAMAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/9ICD/0yAg/2UgIP8MICD/ACAg/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAg/wAgIP8AICD/JyAg/6cgIP/4ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//cgIP+lICD/JyAg/wAgIP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICD/ACAg/wAgIP89ICD/zCAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/ziAg/z8gIP8AICD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAgIP8AICD/ACAg/0QgIP/ZICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/9ogIP9EICD/ACAg/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAACAg/wAgIP8AICD/PyAg/9ogIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/ZICD/PSAg/wAgIP8AAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAICD/ACAg/wAgIP8oICD/zSAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///Hh7//x0d//8dHf//Hh7//x8f//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/zCAg/ycgIP8AICD/AAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAICD/ACAg/wwgIP+lICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///HR3//yIi//8wMP//QED//05O//9PT///QkL//zMz//8jI///HR3//x8f//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/6cgIP8OICD/AAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAgIP8AICD/ACAg/2UgIP/3ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x0d//8vL///ZGT//6Wl///Q0P//5+f//+/v///v7///6en//9bW//+trf//cnL//zY2//8eHv//Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//ggIP9nICD/ACAg/wAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAgIP8AICD/IiAg/9MgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///JCT//2Ji///Gxv//9/f/////////////////////////////////////////////+/v//9LS//96ev//LS3//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/UICD/IyAg/wAAAAAAAAAAAAAAAAgAAAAIAAAAACAg/wAgIP8AICD/eyAg//4gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x8f//8qKv//kJD///Dw//////////////////////////////39///8/P/////////////////////////////5+f//trb//0JC//8eHv//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/fSAg/wAgIP8AAAAAAAAAAAgAAAAIAAAAACAg/wAgIP8bICD/0iAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///ykp//+amv//+fn//////////////////+np//+3t///jY3//3d3//90dP//hob//6ys///g4P///f3//////////////////8vL//9FRf//Hh7//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/1CAg/x0gIP8AAAAAAAAAAAgAAAAIAgIPACAg/wAgIP9dICD/+yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ISH//4eH///5+f/////////////19f//pqb//0tL//8mJv//HR3//xwc//8dHf//HR3//yMj//8+Pv//iYn//+Li///////////////////Gxv//ODj//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/+yAg/2AgIP8AAgIPAAAAAAgAAAAIFBSeACAg/wUgIP+mICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8dHf//Vlb//+rq//////////////Hx//9/f///Jib//x0d//8gIP//ICD//yAg//8gIP//ICD//yAg//8eHv//Hx///1FR///MzP//////////////////m5v//yMj//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/6ggIP8GFBShAAAAAAgAAAAIGxvaACAg/x0gIP/YICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x8f//8nJ///s7P/////////////+/v//4yM//8iIv//Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x0d//9ISP//2dn/////////////7Oz//1JS//8dHf//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/9ogIP8fHBzcAAAAAAgAAAAIHh7sACAg/0MgIP/0ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x0d//9TU///7+//////////////w8P//zAw//8fH///ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8eHv//bW3///X1/////////////5ub//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//QgIP9DHh7tAAAAAAgAAAAIHR3qACAg/2ggIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x4e//+Pj//////////////6+v//bW3//x0d//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///x8f//8fH///Hx///x8f//8fH///KCj//7u7/////////////9TU//8zM///Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP9lHh7rAAAAAAgAAAAIGxvYACAg/4ggIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///ygo//+9vf/////////////c3P//OTn//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///Jyf//ygo//8oKP//KCj//ygo//8oKP//JSX//4KC///+/v////////Dw//9SUv//HR3//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+HGxvaAAAAAAgAAAAIFRWlACAg/50gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///zMz///W1v////////////+xsf//JCT//yAg//8gIP//ICD//yAg//8gIP//ICD//yYm//97e///ubn//7u7//+7u///u7v//7u7//+7u///urr//87O///8/P////////v7//9ra///HBz//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+bFhatAAAAAAgAAAAIAgIRACAg/6YgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hh7//zk5///k5P////////////+Tk///Hh7//yAg//8gIP//ICD//yAg//8gIP//HR3//1JS///t7f////////////////////////////////////////////////////////////93d///HBz//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+mAgIQAAAAAAgAAAAIAgIQACAg/6YgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hh7//zk5///k5P////////////+Pj///HR3//yAg//8gIP//ICD//yAg//8gIP//HR3//09P///s7P////////////////////////////////////////////////////////f3//9kZP//HR3//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+mAgIRAAAAAAgAAAAIFhatACAg/5sgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///zMz///V1f////////////+lpf//ISH//yAg//8gIP//ICD//yAg//8gIP//ICD//yUl//90dP//sLD//7Oz//+zs///s7P//7Oz//+zs///s7P//7Oz//+zs///srL//4CA//8qKv//Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+dFRWlAAAAAAgAAAAIGxvZACAg/4cgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///ycn//+6uv/////////////Ozv//Li7//x8f//8gIP//ICD//yAg//8gIP//ICD//yAg//8eHv//JCT//yUl//8lJf//JSX//yUl//8lJf//JSX//yUl//8lJf//JCT//x8f//8fH///ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP+IGxvZAAAAAAgAAAAIHh7rACAg/2YgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x4e//+MjP/////////////z8///X1///x0d//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP9oHR3qAAAAAAgAAAAIHh7tACAg/0MgIP/0ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x0d//9QUP//7e3/////////////urr//yws//8fH///ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8eHv//HR3//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//QgIP9DHh7sAAAAAAgAAAAIHBzcACAg/x8gIP/aICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8lJf//q6v/////////////+vr//4yM//8jI///Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x4e//9CQv//cXH//0lJ//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/9ggIP8dGxvaAAAAAAgAAAAIFBShACAg/wYgIP+oICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8dHf//UVH//+bm//////////////Pz//+Kiv//Kyv//x0d//8fH///ICD//yAg//8gIP//ICD//yAg//8eHv//ISH//2Rk///Z2f///v7//9nZ//9CQv//Hh7//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/6YgIP8FFBSeAAAAAAgAAAAIAgIPACAg/wAgIP9gICD/+yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//39////4+P/////////////4+P//tbX//1dX//8pKf//Hh7//xwc//8dHf//HR3//yIi//86Ov//jo7//+3t//////////////b2//9bW///HR3//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/+yAg/10gIP8AAgIPAAAAAAgAAAAIAAAAACAg/wAgIP8dICD/1CAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//Hx///ycn//+UlP//+Pj///////////////////Dw///Bwf//kZH//3l5//9zc///goL//6en///b2////Pz//////////////////729//8wMP//Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/0iAg/xsgIP8AAAAAAAAAAAgAAAAIAAAAACAg/wAgIP8AICD/fiAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x8f//8oKP//h4f//+vr//////////////////////////////39///8/P///v7////////////////////////7+///t7f//0BA//8fH///ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/+ICD/eyAg/wAgIP8AAAAAAAAAAAgAAAAIAAAAAAAAAAAgIP8AICD/JCAg/9UgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///ISH//1lZ///AwP//9/f//////////////////////////////////////////////Pz//9jY//+Bgf//Li7//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/TICD/IiAg/wAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAgIP8AICD/ACAg/2cgIP/4ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//x4e//8tLf//YWH//6Wl///T0///6+v///Ly///z8///7u7//9ra//+zs///d3f//zo6//8fH///Hx///yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//cgIP9lICD/ACAg/wAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAICD/ACAg/w4gIP+nICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///HR3//yIi//8xMf//Rkb//1ZW//9YWP//S0v//zY2//8lJf//HR3//x4e//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/6UgIP8MICD/AAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAICD/ACAg/wAgIP8nICD/zCAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8fH///Hh7//x0d//8dHf//Hh7//x8f//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD/zSAg/ycgIP8AICD/AAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAACAg/wAgIP8AICD/PSAg/9kgIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP/aICD/PyAg/wAgIP8AAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAgIP8AICD/ACAg/0QgIP/aICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8gIP//ICD//yAg/9kgIP9EICD/ACAg/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICD/ACAg/wAgIP8/ICD/zSAg//8gIP//ICD//yAg//8gIP//ICD//yAg//8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AIAAEAAAAAAAgAAQAAAAAACAABAAAAAAAIAAEAAAAAAAgAAQAAAAAACAABAAAAAAAIAAEAAAAAAAgAAQAAAAAACAABAAAAAAAIAAGAAAAAABgAAYAAAAAAGAABwAAAAAA4AAHAAAAAADgAAeAAAAAAeAAB4AAAAAB4AAHwAAAAAPgAAfgAAAAB+AAB/AAAAAP4AAH+AAAAB/gAAf8AAAAP+AAB/4AAAB/4AAH/wAAAf/gAAf/wAAD/+AAB//4AB//4AAH///////gAAAAAAAAAAAAA=") + +# Init Config and Log +$ghelper_app_path = "$($env:LOCALAPPDATA)\GHelper" +$ghelper_config_path = "$ghelper_app_path\config.json" +$ghelper_log_path = "$ghelper_app_path\log.txt" + +New-Item -ItemType Directory -Force -Path $ghelper_app_path + +#Systray menu +$Main_Tool_Icon = New-Object System.Windows.Forms.NotifyIcon +$Main_Tool_Icon.Text = "G14 Helper" +$Main_Tool_Icon.Icon = $icon_standard +$Main_Tool_Icon.Visible = $true + +$Menu_Perf_Title = New-Object System.Windows.Forms.MenuItem("Mode") +$Menu_Perf_Title.Enabled = $false + +$Menu_Perf_Silent = New-Object System.Windows.Forms.MenuItem("Silent") +$Menu_Perf_Balanced = New-Object System.Windows.Forms.MenuItem("Balanced") +$Menu_Perf_Turbo = New-Object System.Windows.Forms.MenuItem("Turbo") + +$Menu_Eco = New-Object System.Windows.Forms.MenuItem("Eco") +$Menu_Standard = New-Object System.Windows.Forms.MenuItem("Standard") +$Menu_Ultimate = New-Object System.Windows.Forms.MenuItem("Ultimate") + +$Menu_Title = New-Object System.Windows.Forms.MenuItem("GPU Mode") +$Menu_Title.Enabled = $false +$Menu_Eco = New-Object System.Windows.Forms.MenuItem("Eco") +$Menu_Standard = New-Object System.Windows.Forms.MenuItem("Standard") +$Menu_Ultimate = New-Object System.Windows.Forms.MenuItem("Ultimate") + +$Menu_RR = New-Object System.Windows.Forms.MenuItem +$Menu_RR.Enabled = $false +$Menu_RR60 = New-Object System.Windows.Forms.MenuItem("60Hz") +$Menu_RR120 = New-Object System.Windows.Forms.MenuItem("120Hz") +$Menu_OD = New-Object System.Windows.Forms.MenuItem("Panel Overdrive") + + +$Menu_Autostart = New-Object System.Windows.Forms.MenuItem("Run on startup") + +$Menu_Exit = New-Object System.Windows.Forms.MenuItem("Exit") + +$contextmenu = New-Object System.Windows.Forms.ContextMenu + +$contextmenu.MenuItems.AddRange($Menu_Perf_Title) +$contextmenu.MenuItems.AddRange($Menu_Perf_Silent) +$contextmenu.MenuItems.AddRange($Menu_Perf_Balanced) +$contextmenu.MenuItems.AddRange($Menu_Perf_Turbo) +$contextmenu.MenuItems.AddRange("-") + +$contextmenu.MenuItems.AddRange($Menu_Title) +$contextmenu.MenuItems.AddRange($Menu_Eco) +$contextmenu.MenuItems.AddRange($Menu_Standard) +$contextmenu.MenuItems.AddRange($Menu_Ultimate) +$contextmenu.MenuItems.AddRange("-") + +$contextmenu.MenuItems.AddRange($Menu_RR) +$contextmenu.MenuItems.AddRange($Menu_RR60) +$contextmenu.MenuItems.AddRange($Menu_RR120) +$contextmenu.MenuItems.AddRange($Menu_OD) + +$contextmenu.MenuItems.AddRange("-") + +$Menu_Charge60 = New-Object System.Windows.Forms.MenuItem("60%") +$Menu_Charge80 = New-Object System.Windows.Forms.MenuItem("80%") +$Menu_Charge100 = New-Object System.Windows.Forms.MenuItem("100%") + +$Submenu_Charge = New-Object System.Windows.Forms.MenuItem("Charge Limit") +$Submenu_Charge.MenuItems.AddRange($Menu_Charge60) +$Submenu_Charge.MenuItems.AddRange($Menu_Charge80) +$Submenu_Charge.MenuItems.AddRange($Menu_Charge100) +$contextmenu.MenuItems.AddRange($Submenu_Charge) + + +$contextmenu.MenuItems.AddRange("-") +$contextmenu.MenuItems.AddRange($Menu_Autostart) + +$contextmenu.MenuItems.AddRange("-") +$contextmenu.MenuItems.AddRange($Menu_Exit) + + +$Main_Tool_Icon.ContextMenu = $contextmenu + + +# Hardware Initialisation + +$device_performance = 0x00120075; +$device_eco = 0x00090020; +$device_mux = 0x00090016; +$device_overdrive = 0x00050019; + +$asushw = Get-CimInstance -Namespace root/wmi -ClassName AsusAtkWmi_WMNB + +function CheckScreen { + + $laptopScreen = isLaptopScreenMain; + if (-Not $laptopScreen) { + $Menu_RR.Text = "External Screen is main"; + $Menu_RR60.Visible = $false; + $Menu_RR120.Visible = $false; + $Menu_OD.Visible = $false; + return; + } else { + $Menu_RR.Text = "Screen Refresh" + $Menu_RR60.Visible = $true; + $Menu_RR120.Visible = $true; + $Menu_OD.Visible = $true; + } + + $refresh_rate = Get-ScreenRefreshRate + if ($refresh_rate -eq 60) { + $Menu_RR.Text = "Laptop Screen Refresh: "+$refresh_rate+"Hz" + $Menu_RR60.Checked = $true; + $Menu_RR120.Checked = $false; + } elseif ($refresh_rate -eq 120) { + $Menu_RR.Text = "Laptop Screen Refresh: "+$refresh_rate+"Hz" + $Menu_RR60.Checked = $false; + $Menu_RR120.Checked = $true; + } + + $screen_overdrive = (Invoke-CimMethod $asushw -MethodName DSTS -Arguments @{Device_ID=$device_overdrive} | Select-Object -ExpandProperty device_status) - 65536; + if ($screen_overdrive -eq 1) { + $Menu_OD.Checked = $true; + $Menu_OD.Enabled = $true; + } elseif ($screen_overdrive -eq 0) { + $Menu_OD.Checked = $false; + $Menu_OD.Enabled = $true; + } else { + $Menu_OD.Enabled = $false; + } + +} + +function GetCPUTemperature { + $t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" + $returntemp = "" + + foreach ($temp in $t.CurrentTemperature) + { + $currentTempCelsius = ($temp / 10) + $returntemp += $currentTempCelsius.ToString() + "C " + } + return $returntemp +} + + +function UICheckStats { + $cpu_fan = [math]::Round(((Invoke-CimMethod $asushw -MethodName DSTS -Arguments @{Device_ID=0x00110013} | Select-Object -ExpandProperty device_status) - 65536)/0.6); + $gpu_fan = [math]::Round(((Invoke-CimMethod $asushw -MethodName DSTS -Arguments @{Device_ID=0x00110014} | Select-Object -ExpandProperty device_status) - 65536)/0.6); + $Menu_Perf_Title.Text = $script:title_performance+" | CPU Fan: "+$cpu_fan.ToString()+"%" + $Menu_Title.Text = $script:title_gpu+" | GPU Fan: "+$gpu_fan.ToString()+"%" +} + +function Get-TimeStamp { + return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date) +} + +function WriteLog ([string]$event_name) { + Write-Output "$(Get-TimeStamp) $event_name" | Out-file $ghelper_log_path -append +} + +function SaveConfigSetting ([string]$Name, $Value){ + + $global:ghelper_config[$Name] = $Value + + $config = $global:ghelper_config + $config | ConvertTo-Json | Out-File $ghelper_config_path +} + +function GetConfigSetting ([string]$Name) { + return $global:ghelper_config[$Name] +} + +function LoadConfig { + + $global:ghelper_config = @{} + + $configJson = (Get-Content -Raw $ghelper_config_path -ErrorAction SilentlyContinue -ErrorVariable ConfigError) | ConvertFrom-Json + $configJson.psobject.properties | Foreach { $global:ghelper_config[$_.Name] = $_.Value } + + if ($ConfigError) { + $global:ghelper_config = @{ + "performance_mode" = 0 + "panel_overdrive" = 1 + } + + $config = $global:ghelper_config + $config | ConvertTo-Json | Out-File $ghelper_config_path + } + +} + +function SetPeformanceMode ($performance_mode = 0) { + + $Menu_Perf_Silent.Checked = $false; + $Menu_Perf_Balanced.Checked = $false; + $Menu_Perf_Turbo.Checked = $false; + + switch ($performance_mode) + { + 1 { + $script:title_performance = "Mode: Turbo" + $Menu_Perf_Turbo.Checked = $true + } + 2 { + $script:title_performance = "Mode: Silent" + $Menu_Perf_Silent.Checked = $true + } + Default { + $script:title_performance = "Mode: Balanced" + $Menu_Perf_Balanced.Checked = $true + $performance_mode = 0 + } + + } + + SaveConfigSetting -Name 'performance_mode' -Value $performance_mode + UICheckStats + + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_performance ; Control_status=$performance_mode } | Out-Null + WriteLog("Performance set to "+$performance_mode) +} + +function SetChargeLimit ($charge_limit = 100) { + + $Menu_Charge60.Checked = $false; + $Menu_Charge80.Checked = $false; + $Menu_Charge100.Checked = $false; + + switch ($charge_limit) + { + 60 { + $Menu_Charge60.Checked = $true + } + 80 { + $Menu_Charge80.Checked = $true + } + Default { + $Menu_Charge100.Checked = $true + $charge_limit = 100 + } + } + + SaveConfigSetting -Name 'charge_limit' -Value $charge_limit + $Submenu_Charge.Text = "Charge Limit: $charge_limit%" + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=0x00120057 ; Control_status=$charge_limit } | Out-Null + WriteLog("Charge limit set to "+$charge_limit) +} + + +function SetPanelOverdrive ($overdrive = 1) { + SaveConfigSetting -Name 'panel_overdrive' -Value $overdrive + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_overdrive ; Control_status=$overdrive } | Out-Null + WriteLog("Panel Overdrive set to "+$overdrive) +} + + +function GetGPUMode { + + $mux_mode = (Invoke-CimMethod $asushw -MethodName DSTS -Arguments @{Device_ID=$device_mux} | Select-Object -ExpandProperty device_status) - 65536; + $eco_mode = (Invoke-CimMethod $asushw -MethodName DSTS -Arguments @{Device_ID=$device_eco} | Select-Object -ExpandProperty device_status) - 65536; + $script:gpu_mode = "standard" + + if ($mux_mode -eq 0) { + $script:gpu_mode = "ultimate" + } else { + + if ($eco_mode -eq 1) { + $script:gpu_mode = "eco" + } else { + $script:gpu_mode = "standard" + } + + if (-Not $mux_mode -eq 1) { + # No MUX Switch + $Menu_Ultimate.Enabled = $false + } + } + + UIGPUMode($script:gpu_mode) + WriteLog("GPU mode detected : $script:gpu_mode") +} + + +function SetGPUMode ($gpu_mode = "standard") { + + if ($gpu_mode -eq $script:gpu_mode) {return} + + $restart = $false; + $changed = $false; + + if ($script:gpu_mode -eq "ultimate") { + $msgBox = [System.Windows.MessageBox]::Show('Switching off Ultimate Mode requires restart','Reboot now?','OKCancel') + if ($msgBox -eq 'OK') { + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_mux ; Control_status=1 } + $restart = $true; + $changed = $true; + } + } elseif ($gpu_mode -eq "ultimate") { + $msgBox = [System.Windows.MessageBox]::Show('Ultimate mode requires restart','Reboot now?','OKCancel') + if ($msgBox -eq 'OK') { + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_mux ; Control_status=0 } + $restart = $true; + $changed = $true; + } + } elseif ($gpu_mode -eq "eco") { + UIGPUMode($gpu_mode); + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_eco ; Control_status=1 } + $changed = $true; + } elseif ($gpu_mode -eq "standard") { + UIGPUMode($gpu_mode); + Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_eco ; Control_status=0 } + $changed = $true; + } + + if ($changed) { + $script:gpu_mode = $gpu_mode; + SaveConfigSetting -Name 'gpu_mode' -Value $gpu_mode + WriteLog("GPU set to "+$gpu_mode) + } + + + if ($restart) { + UIGPUMode($gpu_mode); + WriteLog("Restarting") + Restart-Computer + } + +} + +function UIGPUMode ($gpu_mode) { + + $Menu_Eco.Checked = $false; + $Menu_Standard.Checked = $false; + $Menu_Ultimate.Checked = $false; + + switch ($gpu_mode) + { + "eco" { + $script:title_gpu = "GPU: iGPU only" + $Menu_Eco.Checked = $true + $Main_Tool_Icon.Icon = $icon_eco + } + "ultimate" { + $script:title_gpu = "GPU: dGPU" + $Menu_Ultimate.Checked = $true + $Main_Tool_Icon.Icon = $icon_ultimate + } + Default { + $script:title_gpu = "GPU: Balanced" + $Menu_Standard.Checked = $true + $gpu_mode = "standard" + $Main_Tool_Icon.Icon = $icon_standard + } + } + + UICheckStats + +} + +LoadConfig + +SetPeformanceMode(GetConfigSetting('performance_mode')) +SetPanelOverdrive(GetConfigSetting('panel_overdrive')) +SetChargeLimit(GetConfigSetting('charge_limit')) + +GetGPUMode + +CheckAutostart +CheckScreen + + +$timer = New-Object System.Windows.Forms.Timer +$timer.Add_Tick({UICheckStats}) +$timer.Interval = 5000 +$timer.Enabled = $True + +# --------------------------------------------------------------------- +# Action when after a click on the systray icon +# --------------------------------------------------------------------- +$Main_Tool_Icon.Add_Click({ + CheckScreen + UICheckStats + If ($_.Button -eq [Windows.Forms.MouseButtons]::Left) { + $Main_Tool_Icon.GetType().GetMethod("ShowContextMenu",[System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).Invoke($Main_Tool_Icon,$null) + } +}) + + +$Menu_Perf_Silent.add_Click({ + SetPeformanceMode(2) +}) + +$Menu_Perf_Balanced.add_Click({ + SetPeformanceMode(0) +}) + +$Menu_Perf_Turbo.add_Click({ + SetPeformanceMode(1) +}) + +$Menu_Eco.add_Click({ + SetGPUMode("eco") +}) + +$Menu_Standard.add_Click({ + SetGPUMode("standard") +}) + +$Menu_Ultimate.add_Click({ + SetGPUMode("ultimate") +}) + + +$Menu_RR60.add_Click({ + Set-ScreenRefreshRate -Frequency 60 + CheckScreen +}) + +$Menu_RR120.add_Click({ + Set-ScreenRefreshRate -Frequency 120 + CheckScreen +}) + +$Menu_Charge60.add_Click({ + SetChargeLimit(60) +}) + +$Menu_Charge80.add_Click({ + SetChargeLimit(80) +}) + +$Menu_Charge100.add_Click({ + SetChargeLimit(100) +}) + +$Menu_OD.add_Click({ + if ($Menu_OD.Checked) { + SetPanelOverdrive(0) + } else { + SetPanelOverdrive(1) + } + CheckScreen +}) + +$Menu_Autostart.add_Click({ + if ($Menu_Autostart.Checked) { + DisableAutostart + } else { + SetAutostart + } + CheckAutostart +}) + + +# When Exit is clicked, close everything and kill the PowerShell process +$Menu_Exit.add_Click({ + $Main_Tool_Icon.Visible = $false + Stop-Process $pid + }) + + +# Make PowerShell Disappear +#$windowcode = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' +#$asyncwindow = Add-Type -MemberDefinition $windowcode -name Win32ShowWindowAsync -namespace Win32Functions -PassThru +#$null = $asyncwindow::ShowWindowAsync((Get-Process -PID $pid).MainWindowHandle, 0) + +# Force garbage collection just to start slightly lower RAM usage. +[System.GC]::Collect() + +Get-EventSubscriber | Unregister-Event + +$ProcessAsusWmiEvent = { + $event_id = $Event.SourceEventArgs.NewEvent.EventID + Write-Host $event_id +} + +Register-CimIndicationEvent -Namespace root\wmi -query "Select * From AsusAtkWmiEvent" ` -sourceIdentifier "GHAsus" ` -action $ProcessAsusWmiEvent + + +# Create an application context for it to all run within. +# This helps with responsiveness, especially when clicking Exit. +$appContext = New-Object System.Windows.Forms.ApplicationContext +[void][System.Windows.Forms.Application]::Run($appContext) + diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 00000000..acacd0ba Binary files /dev/null and b/screenshot.png differ