mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c17c705de | ||
|
|
27f5ed50d5 | ||
|
|
02ae48092b | ||
|
|
41d92d76cc | ||
|
|
44c3d9f3c7 | ||
|
|
146150b1e7 | ||
|
|
ccf4ae5126 | ||
|
|
249fef0bb1 | ||
|
|
2ee9110016 | ||
|
|
bc1f3ab530 | ||
|
|
3cd62bc9e1 | ||
|
|
16f6f3f934 | ||
|
|
1f4afedc1d | ||
|
|
c705ce2b5b | ||
|
|
75942ebdb2 | ||
|
|
6d142213c8 | ||
|
|
bfcb97b158 | ||
|
|
f97765c5c2 | ||
|
|
19a8b0dc22 | ||
|
|
f209f211b5 | ||
|
|
81a0019b42 | ||
|
|
3778c255bc | ||
|
|
a6b597affe | ||
|
|
4aaba5cee7 | ||
|
|
cbbe944c2b | ||
|
|
f4d066d407 | ||
|
|
cc96ca9946 | ||
|
|
fb95d9abb2 | ||
|
|
15112cb5c8 | ||
|
|
2632a1b46d | ||
|
|
66a2a1d083 | ||
|
|
aad708d686 | ||
|
|
dba6dae254 | ||
|
|
b26ceccc42 | ||
|
|
4ad0857ec6 | ||
|
|
d49136a542 |
200
ASUSWmi.cs
Normal file
200
ASUSWmi.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
public class ASUSWmi
|
||||
{
|
||||
|
||||
const string FILE_NAME = @"\\.\\ATKACPI";
|
||||
const uint CONTROL_CODE = 0x0022240C;
|
||||
|
||||
const uint DSTS = 0x53545344;
|
||||
const uint DEVS = 0x53564544;
|
||||
|
||||
public const uint CPU_Fan = 0x00110013;
|
||||
public const uint GPU_Fan = 0x00110014;
|
||||
|
||||
public const uint PerformanceMode = 0x00120075; // Thermal Control
|
||||
|
||||
public const uint GPUEco = 0x00090020;
|
||||
public const uint GPUMux = 0x00090016;
|
||||
|
||||
public const uint BatteryLimit = 0x00120057;
|
||||
public const uint ScreenOverdrive = 0x00050019;
|
||||
|
||||
public const uint DevsCPUFanCurve = 0x00110024;
|
||||
public const uint DevsGPUFanCurve = 0x00110025;
|
||||
|
||||
public const int PerformanceBalanced = 0;
|
||||
public const int PerformanceTurbo = 1;
|
||||
public const int PerformanceSilent = 2;
|
||||
|
||||
public const int GPUModeEco = 0;
|
||||
public const int GPUModeStandard = 1;
|
||||
public const int GPUModeUltimate = 2;
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr CreateFile(
|
||||
string lpFileName,
|
||||
uint dwDesiredAccess,
|
||||
uint dwShareMode,
|
||||
IntPtr lpSecurityAttributes,
|
||||
uint dwCreationDisposition,
|
||||
uint dwFlagsAndAttributes,
|
||||
IntPtr hTemplateFile
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool DeviceIoControl(
|
||||
IntPtr hDevice,
|
||||
uint dwIoControlCode,
|
||||
byte[] lpInBuffer,
|
||||
uint nInBufferSize,
|
||||
byte[] lpOutBuffer,
|
||||
uint nOutBufferSize,
|
||||
ref uint lpBytesReturned,
|
||||
IntPtr lpOverlapped
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool CloseHandle(IntPtr hObject);
|
||||
|
||||
private const uint GENERIC_READ = 0x80000000;
|
||||
private const uint GENERIC_WRITE = 0x40000000;
|
||||
private const uint OPEN_EXISTING = 3;
|
||||
private const uint FILE_ATTRIBUTE_NORMAL = 0x80;
|
||||
private const uint FILE_SHARE_READ = 1;
|
||||
private const uint FILE_SHARE_WRITE = 2;
|
||||
|
||||
private IntPtr handle;
|
||||
|
||||
public ASUSWmi()
|
||||
{
|
||||
handle = CreateFile(
|
||||
FILE_NAME,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
IntPtr.Zero,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
IntPtr.Zero
|
||||
);
|
||||
if (handle == new IntPtr(-1))
|
||||
{
|
||||
throw new Exception("Can't connect to ACPI");
|
||||
}
|
||||
}
|
||||
|
||||
public void Control(uint dwIoControlCode, byte[] lpInBuffer, byte[] lpOutBuffer)
|
||||
{
|
||||
uint lpBytesReturned = 0;
|
||||
bool result = DeviceIoControl(
|
||||
handle,
|
||||
dwIoControlCode,
|
||||
lpInBuffer,
|
||||
(uint)lpInBuffer.Length,
|
||||
lpOutBuffer,
|
||||
(uint)lpOutBuffer.Length,
|
||||
ref lpBytesReturned,
|
||||
IntPtr.Zero
|
||||
);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
|
||||
protected byte[] CallMethod(uint MethodID, byte[] args)
|
||||
{
|
||||
byte[] acpiBuf = new byte[8 + args.Length];
|
||||
byte[] outBuffer = new byte[20];
|
||||
|
||||
BitConverter.GetBytes((uint)MethodID).CopyTo(acpiBuf, 0);
|
||||
BitConverter.GetBytes((uint)args.Length).CopyTo(acpiBuf, 4);
|
||||
Array.Copy(args, 0, acpiBuf, 8, args.Length);
|
||||
|
||||
// if (MethodID == DEVS) Debug.WriteLine(BitConverter.ToString(acpiBuf, 0, acpiBuf.Length));
|
||||
|
||||
Control(CONTROL_CODE, acpiBuf, outBuffer);
|
||||
|
||||
return outBuffer;
|
||||
|
||||
}
|
||||
|
||||
public void DeviceSet(uint DeviceID, int Status)
|
||||
{
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
CallMethod(DEVS, args);
|
||||
}
|
||||
|
||||
|
||||
public void DeviceSet(uint DeviceID, byte[] Params)
|
||||
{
|
||||
byte[] args = new byte[4 + Params.Length];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
Params.CopyTo(args, 4);
|
||||
CallMethod(DEVS, args);
|
||||
}
|
||||
|
||||
|
||||
public int DeviceGet(uint DeviceID)
|
||||
{
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
byte[] status = CallMethod(DSTS, args);
|
||||
return BitConverter.ToInt32(status, 0) - 65536;
|
||||
}
|
||||
|
||||
public byte[] DeviceGetBuffer(uint DeviceID, uint Status = 0)
|
||||
{
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
return CallMethod(DSTS, args);
|
||||
}
|
||||
|
||||
|
||||
public void SetFanCurve(int device, byte[] curve)
|
||||
{
|
||||
|
||||
if (device == 1)
|
||||
DeviceSet(DevsGPUFanCurve, curve);
|
||||
else
|
||||
DeviceSet(DevsCPUFanCurve, curve);
|
||||
}
|
||||
|
||||
public byte[] GetFanCurve(int device, int mode = 0)
|
||||
{
|
||||
uint fan_mode;
|
||||
|
||||
// because it's asus, and modes are swapped here
|
||||
switch (mode)
|
||||
{
|
||||
case 1:fan_mode = 2; break;
|
||||
case 2: fan_mode = 1; break;
|
||||
default: fan_mode = 0; break;
|
||||
}
|
||||
|
||||
if (device == 1)
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
else
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
||||
{
|
||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||
watcher.Scope = new ManagementScope("root\\wmi");
|
||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||
watcher.Start();
|
||||
}
|
||||
|
||||
}
|
||||
68
Aura.cs
Normal file
68
Aura.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using HidLibrary;
|
||||
|
||||
public class Aura
|
||||
{
|
||||
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5 };
|
||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
|
||||
|
||||
public const int Static = 0;
|
||||
public const int Breathe = 1;
|
||||
public const int Strobe = 2;
|
||||
public const int Rainbow = 3;
|
||||
public const int Dingding = 10;
|
||||
|
||||
public const int SpeedSlow = 0;
|
||||
public const int SpeedMedium = 1;
|
||||
public const int SpeedHigh = 2;
|
||||
|
||||
public static int Mode = Static;
|
||||
public static Color Color1 = Color.White;
|
||||
public static Color Color2 = Color.Black;
|
||||
public static int Speed = SpeedSlow;
|
||||
|
||||
public static byte[] AuraMessage(int mode, Color color, Color color2, int speed)
|
||||
{
|
||||
byte[] msg = new byte[17];
|
||||
msg[0] = 0x5d;
|
||||
msg[1] = 0xb3;
|
||||
msg[2] = 0x00; // Zone
|
||||
msg[3] = (byte)mode; // Aura Mode
|
||||
msg[4] = (byte)(color.R); // R
|
||||
msg[5] = (byte)(color.G); // G
|
||||
msg[6] = (byte)(color.B); // B
|
||||
msg[7] = (byte)speed; // aura.speed as u8;
|
||||
msg[8] = 0; // aura.direction as u8;
|
||||
msg[10] = (byte)(color2.R); // R
|
||||
msg[11] = (byte)(color2.G); // G
|
||||
msg[12] = (byte)(color2.B); // B
|
||||
return msg;
|
||||
}
|
||||
|
||||
public static void ApplyAura()
|
||||
{
|
||||
|
||||
HidDevice[] HidDeviceList;
|
||||
int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6 };
|
||||
|
||||
HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
{
|
||||
if (device.IsConnected)
|
||||
{
|
||||
if (device.Description.IndexOf("HID") >= 0)
|
||||
{
|
||||
device.OpenDevice();
|
||||
byte[] msg = AuraMessage(Mode, Color1, Color2, Speed);
|
||||
device.Write(msg);
|
||||
device.Write(MESSAGE_SET);
|
||||
device.Write(MESSAGE_APPLY);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
125
Fans.Designer.cs
generated
Normal file
125
Fans.Designer.cs
generated
Normal file
@@ -0,0 +1,125 @@
|
||||
namespace GHelper
|
||||
{
|
||||
partial class Fans
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
buttonApply = new Button();
|
||||
buttonReset = new Button();
|
||||
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// chartCPU
|
||||
//
|
||||
chartArea1.Name = "ChartArea1";
|
||||
chartCPU.ChartAreas.Add(chartArea1);
|
||||
legend1.Name = "Legend1";
|
||||
chartCPU.Legends.Add(legend1);
|
||||
chartCPU.Location = new Point(16, 13);
|
||||
chartCPU.Name = "chartCPU";
|
||||
series1.ChartArea = "ChartArea1";
|
||||
series1.Legend = "Legend1";
|
||||
series1.Name = "Series1";
|
||||
chartCPU.Series.Add(series1);
|
||||
chartCPU.Size = new Size(900, 446);
|
||||
chartCPU.TabIndex = 0;
|
||||
chartCPU.Text = "chartCPU";
|
||||
//
|
||||
// buttonApply
|
||||
//
|
||||
buttonApply.Location = new Point(662, 944);
|
||||
buttonApply.Name = "buttonApply";
|
||||
buttonApply.Size = new Size(254, 46);
|
||||
buttonApply.TabIndex = 1;
|
||||
buttonApply.Text = "Apply Fan Curve";
|
||||
buttonApply.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonReset
|
||||
//
|
||||
buttonReset.Location = new Point(402, 944);
|
||||
buttonReset.Name = "buttonReset";
|
||||
buttonReset.Size = new Size(254, 46);
|
||||
buttonReset.TabIndex = 2;
|
||||
buttonReset.Text = "Factory Defaults";
|
||||
buttonReset.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chartGPU
|
||||
//
|
||||
chartArea2.Name = "ChartArea1";
|
||||
chartGPU.ChartAreas.Add(chartArea2);
|
||||
legend2.Name = "Legend1";
|
||||
chartGPU.Legends.Add(legend2);
|
||||
chartGPU.Location = new Point(16, 477);
|
||||
chartGPU.Name = "chartGPU";
|
||||
series2.ChartArea = "ChartArea1";
|
||||
series2.Legend = "Legend1";
|
||||
series2.Name = "Series1";
|
||||
chartGPU.Series.Add(series2);
|
||||
chartGPU.Size = new Size(900, 448);
|
||||
chartGPU.TabIndex = 3;
|
||||
chartGPU.Text = "chart1";
|
||||
//
|
||||
// Fans
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(940, 1020);
|
||||
Controls.Add(chartGPU);
|
||||
Controls.Add(buttonReset);
|
||||
Controls.Add(buttonApply);
|
||||
Controls.Add(chartCPU);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
Name = "Fans";
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Fans";
|
||||
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
|
||||
private Button buttonApply;
|
||||
private Button buttonReset;
|
||||
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
|
||||
}
|
||||
}
|
||||
212
Fans.cs
Normal file
212
Fans.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class Fans : Form
|
||||
{
|
||||
|
||||
DataPoint curPoint = null;
|
||||
Series seriesCPU;
|
||||
Series seriesGPU;
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
{
|
||||
|
||||
string title;
|
||||
|
||||
if (device == 1)
|
||||
title = "GPU Fan Profile";
|
||||
else
|
||||
title = "CPU Fan Profile";
|
||||
|
||||
if (Program.settingsForm.perfName.Length > 0)
|
||||
title += ": " + Program.settingsForm.perfName;
|
||||
|
||||
if (chart.Titles.Count > 0)
|
||||
chart.Titles[0].Text = title;
|
||||
else
|
||||
chart.Titles.Add(title);
|
||||
|
||||
chart.ChartAreas[0].AxisX.Minimum = 10;
|
||||
chart.ChartAreas[0].AxisX.Maximum = 100;
|
||||
chart.ChartAreas[0].AxisX.Interval = 10;
|
||||
chart.ChartAreas[0].AxisY.Minimum = 0;
|
||||
chart.ChartAreas[0].AxisY.Maximum = 100;
|
||||
chart.Legends[0].Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
private void Fans_Shown(object? sender, EventArgs e)
|
||||
{
|
||||
Top = Program.settingsForm.Top;
|
||||
Left = Program.settingsForm.Left - Width - 10;
|
||||
}
|
||||
|
||||
public Fans()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
seriesCPU = chartCPU.Series.Add("CPU");
|
||||
seriesGPU = chartGPU.Series.Add("GPU");
|
||||
|
||||
seriesCPU.Color = Color.Blue;
|
||||
seriesGPU.Color = Color.Red;
|
||||
|
||||
LoadFans();
|
||||
|
||||
chartCPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartCPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
chartGPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartGPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
buttonReset.Click += ButtonReset_Click;
|
||||
buttonApply.Click += ButtonApply_Click;
|
||||
|
||||
Shown += Fans_Shown;
|
||||
|
||||
}
|
||||
|
||||
public void LoadFans()
|
||||
{
|
||||
|
||||
SetChart(chartCPU, 0);
|
||||
SetChart(chartGPU, 0);
|
||||
|
||||
LoadProfile(seriesCPU, 0);
|
||||
LoadProfile(seriesGPU, 1);
|
||||
|
||||
}
|
||||
|
||||
byte[] StringToBytes(string str)
|
||||
{
|
||||
String[] arr = str.Split('-');
|
||||
byte[] array = new byte[arr.Length];
|
||||
for (int i = 0; i < arr.Length; i++) array[i] = Convert.ToByte(arr[i], 16);
|
||||
return array;
|
||||
}
|
||||
|
||||
string GetFanName(int device)
|
||||
{
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
string name;
|
||||
|
||||
if (device == 1)
|
||||
name = "gpu";
|
||||
else
|
||||
name = "cpu";
|
||||
|
||||
return "fan_profile_" + name + "_" + mode;
|
||||
}
|
||||
|
||||
void LoadProfile(Series series, int device, int def = 0)
|
||||
{
|
||||
|
||||
series.ChartType = SeriesChartType.Line;
|
||||
series.MarkerSize = 10;
|
||||
series.MarkerStyle = MarkerStyle.Circle;
|
||||
|
||||
series.Points.Clear();
|
||||
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
string curveString = Program.config.getConfigString(GetFanName(device));
|
||||
byte[] curve = { };
|
||||
|
||||
if (curveString is not null)
|
||||
curve = StringToBytes(curveString);
|
||||
|
||||
if (def == 1 || curve.Length != 16)
|
||||
curve = Program.wmi.GetFanCurve(device, mode);
|
||||
|
||||
|
||||
//Debug.WriteLine(BitConverter.ToString(curve));
|
||||
|
||||
byte old = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (curve[i] == old) curve[i]++; // preventing 2 points in same spot from default asus profiles
|
||||
series.Points.AddXY(curve[i], curve[i + 8]);
|
||||
old = curve[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ApplyProfile(Series series, int device)
|
||||
{
|
||||
byte[] curve = new byte[16];
|
||||
int i = 0;
|
||||
foreach (DataPoint point in series.Points)
|
||||
{
|
||||
curve[i] = (byte)point.XValue;
|
||||
curve[i + 8] = (byte)point.YValues.First();
|
||||
i++;
|
||||
}
|
||||
|
||||
string bitCurve = BitConverter.ToString(curve);
|
||||
Debug.WriteLine(bitCurve);
|
||||
Program.config.setConfig(GetFanName(device), bitCurve);
|
||||
|
||||
Program.wmi.SetFanCurve(device, curve);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ButtonApply_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ApplyProfile(seriesCPU, 0);
|
||||
ApplyProfile(seriesGPU, 1);
|
||||
}
|
||||
|
||||
private void ButtonReset_Click(object? sender, EventArgs e)
|
||||
{
|
||||
LoadProfile(seriesCPU, 0, 1);
|
||||
LoadProfile(seriesGPU, 1, 1);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"));
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
curPoint = null;
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
if (sender is null) return;
|
||||
|
||||
Chart chart = (Chart)sender;
|
||||
|
||||
if (e.Button.HasFlag(MouseButtons.Left))
|
||||
{
|
||||
ChartArea ca = chart.ChartAreas[0];
|
||||
Axis ax = ca.AxisX;
|
||||
Axis ay = ca.AxisY;
|
||||
|
||||
HitTestResult hit = chart.HitTest(e.X, e.Y);
|
||||
if (hit.Series is not null && hit.PointIndex >= 0)
|
||||
curPoint = hit.Series.Points[hit.PointIndex];
|
||||
|
||||
|
||||
if (curPoint != null)
|
||||
{
|
||||
Series s = hit.Series;
|
||||
double dx = ax.PixelPositionToValue(e.X);
|
||||
double dy = ay.PixelPositionToValue(e.Y);
|
||||
|
||||
if (dx < 0) dx = 0;
|
||||
if (dx > 100) dx = 100;
|
||||
|
||||
if (dy < 0) dy = 0;
|
||||
if (dy > 100) dy = 100;
|
||||
|
||||
curPoint.XValue = dx;
|
||||
curPoint.YValues[0] = dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
60
Fans.resx
Normal file
60
Fans.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -2,14 +2,18 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<TargetFramework>net7.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<StartupObject>GHelper.Program</StartupObject>
|
||||
<ApplicationIcon>Resources\standard.ico</ApplicationIcon>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||
<AssemblyName>GHelper</AssemblyName>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -24,15 +28,16 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\standard.ico">
|
||||
<Content Include="favicon.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.1" />
|
||||
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
<PackageReference Include="WinForms.DataVisualization" Version="1.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -46,22 +51,22 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\eco.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-charging-battery-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-laptop-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-speed-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\icons8-video-card-48.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ultimate.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33403.182
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHelper", "GHelper.csproj", "{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GHelper", "GHelper.csproj", "{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B6E44CC6-5D28-4CB9-8EE2-BE9D6238E2D6}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@@ -13,13 +13,19 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.ActiveCfg = Release|x64
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.Build.0 = Release|x64
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.ActiveCfg = Release|x64
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
260
NativeMethods.cs
Normal file
260
NativeMethods.cs
Normal file
@@ -0,0 +1,260 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class NativeMethods
|
||||
{
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
|
||||
public const int SW_RESTORE = 9;
|
||||
|
||||
public static bool SwitchToCurrent()
|
||||
{
|
||||
IntPtr hWnd = IntPtr.Zero;
|
||||
Process process = Process.GetCurrentProcess();
|
||||
Process[] processes = Process.GetProcessesByName(process.ProcessName);
|
||||
foreach (Process _process in processes)
|
||||
{
|
||||
if (_process.Id != process.Id)
|
||||
{
|
||||
|
||||
if (_process.MainWindowHandle != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine(_process.Id);
|
||||
Debug.WriteLine(process.Id);
|
||||
|
||||
hWnd = _process.MainWindowHandle;
|
||||
ShowWindowAsync(hWnd, SW_RESTORE);
|
||||
}
|
||||
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerWriteDCValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
int AcValueIndex);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerWriteACValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
int AcValueIndex);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
out IntPtr AcValueIndex
|
||||
);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerReadDCValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
out IntPtr AcValueIndex
|
||||
);
|
||||
|
||||
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerSetActiveScheme(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerGetActiveScheme(IntPtr UserPowerKey, out IntPtr ActivePolicyGuid);
|
||||
|
||||
static readonly Guid GUID_CPU = new Guid("54533251-82be-4824-96c1-47b60b740d00");
|
||||
static readonly Guid GUID_BOOST = new Guid("be337238-0d82-4146-a960-4f3749d470c7");
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct DEVMODE
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string dmDeviceName;
|
||||
|
||||
public short dmSpecVersion;
|
||||
public short dmDriverVersion;
|
||||
public short dmSize;
|
||||
public short dmDriverExtra;
|
||||
public int dmFields;
|
||||
public int dmPositionX;
|
||||
public int dmPositionY;
|
||||
public int dmDisplayOrientation;
|
||||
public int dmDisplayFixedOutput;
|
||||
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;
|
||||
};
|
||||
|
||||
[Flags()]
|
||||
public enum DisplaySettingsFlags : int
|
||||
{
|
||||
CDS_UPDATEREGISTRY = 1,
|
||||
CDS_TEST = 2,
|
||||
CDS_FULLSCREEN = 4,
|
||||
CDS_GLOBAL = 8,
|
||||
CDS_SET_PRIMARY = 0x10,
|
||||
CDS_RESET = 0x40000000,
|
||||
CDS_NORESET = 0x10000000
|
||||
}
|
||||
|
||||
// PInvoke declaration for EnumDisplaySettings Win32 API
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int EnumDisplaySettingsEx(
|
||||
string lpszDeviceName,
|
||||
int iModeNum,
|
||||
ref DEVMODE lpDevMode);
|
||||
|
||||
// PInvoke declaration for ChangeDisplaySettings Win32 API
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int ChangeDisplaySettingsEx(
|
||||
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
||||
DisplaySettingsFlags dwflags, IntPtr lParam);
|
||||
|
||||
|
||||
public const int ENUM_CURRENT_SETTINGS = -1;
|
||||
|
||||
public const string laptopScreenName = "\\\\.\\DISPLAY1";
|
||||
|
||||
public static DEVMODE CreateDevmode()
|
||||
{
|
||||
DEVMODE dm = new DEVMODE();
|
||||
dm.dmDeviceName = new String(new char[32]);
|
||||
dm.dmFormName = new String(new char[32]);
|
||||
dm.dmSize = (short)Marshal.SizeOf(dm);
|
||||
return dm;
|
||||
}
|
||||
|
||||
public static Screen FindLaptopScreen()
|
||||
{
|
||||
var screens = Screen.AllScreens;
|
||||
Screen laptopScreen = null;
|
||||
|
||||
foreach (var screen in screens)
|
||||
{
|
||||
if (screen.DeviceName == laptopScreenName)
|
||||
{
|
||||
laptopScreen = screen;
|
||||
}
|
||||
}
|
||||
|
||||
if (laptopScreen is null) return null;
|
||||
else return laptopScreen;
|
||||
}
|
||||
|
||||
public static int GetRefreshRate()
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
|
||||
Screen laptopScreen = FindLaptopScreen();
|
||||
int frequency = -1;
|
||||
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
}
|
||||
|
||||
return frequency;
|
||||
}
|
||||
|
||||
public static int SetRefreshRate(int frequency = 120)
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
Screen laptopScreen = FindLaptopScreen();
|
||||
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
dm.dmDisplayFrequency = frequency;
|
||||
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen.DeviceName, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static Guid GetActiveScheme()
|
||||
{
|
||||
IntPtr pActiveSchemeGuid;
|
||||
var hr = PowerGetActiveScheme(IntPtr.Zero, out pActiveSchemeGuid);
|
||||
Guid activeSchemeGuid = (Guid)Marshal.PtrToStructure(pActiveSchemeGuid, typeof(Guid));
|
||||
return activeSchemeGuid;
|
||||
}
|
||||
|
||||
public static int GetCPUBoost()
|
||||
{
|
||||
IntPtr AcValueIndex;
|
||||
Guid activeSchemeGuid = GetActiveScheme();
|
||||
|
||||
UInt32 value = PowerReadACValueIndex(IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
GUID_CPU,
|
||||
GUID_BOOST, out AcValueIndex);
|
||||
|
||||
return AcValueIndex.ToInt32();
|
||||
|
||||
}
|
||||
|
||||
public static void SetCPUBoost(int boost = 0)
|
||||
{
|
||||
Guid activeSchemeGuid = GetActiveScheme();
|
||||
|
||||
var hrAC = PowerWriteACValueIndex(
|
||||
IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
GUID_CPU,
|
||||
GUID_BOOST,
|
||||
boost);
|
||||
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
|
||||
var hrDC = PowerWriteDCValueIndex(
|
||||
IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
GUID_CPU,
|
||||
GUID_BOOST,
|
||||
boost);
|
||||
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
486
Program.cs
486
Program.cs
@@ -1,155 +1,10 @@
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
public class ASUSWmi
|
||||
{
|
||||
private ManagementObject mo;
|
||||
private ManagementClass classInstance;
|
||||
|
||||
public const int CPU_Fan = 0x00110013;
|
||||
public const int GPU_Fan = 0x00110014;
|
||||
|
||||
public const int PerformanceMode = 0x00120075;
|
||||
|
||||
public const int GPUEco = 0x00090020;
|
||||
public const int GPUMux = 0x00090016;
|
||||
|
||||
public const int BatteryLimit = 0x00120057;
|
||||
public const int ScreenOverdrive = 0x00050019;
|
||||
|
||||
public const int PerformanceBalanced = 0;
|
||||
public const int PerformanceTurbo = 1;
|
||||
public const int PerformanceSilent = 2;
|
||||
|
||||
public const int GPUModeEco = 0;
|
||||
public const int GPUModeStandard = 1;
|
||||
public const int GPUModeUltimate = 2;
|
||||
|
||||
public ASUSWmi()
|
||||
{
|
||||
this.classInstance = new ManagementClass(new ManagementScope("root\\wmi"), new ManagementPath("AsusAtkWmi_WMNB"), null);
|
||||
foreach (ManagementObject mo in this.classInstance.GetInstances())
|
||||
{
|
||||
this.mo = mo;
|
||||
}
|
||||
}
|
||||
|
||||
private int WMICall(string MethodName, int Device_Id, int Control_status = -1)
|
||||
{
|
||||
ManagementBaseObject inParams = this.classInstance.Methods[MethodName].InParameters;
|
||||
inParams["Device_ID"] = Device_Id;
|
||||
if (Control_status != -1)
|
||||
{
|
||||
inParams["Control_status"] = Control_status;
|
||||
}
|
||||
|
||||
ManagementBaseObject outParams = this.mo.InvokeMethod(MethodName, inParams, null);
|
||||
foreach (PropertyData property in outParams.Properties)
|
||||
{
|
||||
if (property.Name == "device_status")
|
||||
{
|
||||
int status;
|
||||
try
|
||||
{
|
||||
status = int.Parse(property.Value.ToString());
|
||||
status -= 65536;
|
||||
return status;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (property.Name == "result")
|
||||
{
|
||||
try
|
||||
{
|
||||
return int.Parse(property.Value.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
public int DeviceGet(int Device_Id)
|
||||
{
|
||||
return this.WMICall("DSTS", Device_Id);
|
||||
}
|
||||
public int DeviceSet(int Device_Id, int Control_status)
|
||||
{
|
||||
return this.WMICall("DEVS", Device_Id, Control_status);
|
||||
}
|
||||
|
||||
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
||||
{
|
||||
|
||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||
|
||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||
watcher.Scope = new ManagementScope("root\\wmi");
|
||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||
|
||||
watcher.Start();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
@@ -202,312 +57,120 @@ public class AppConfig
|
||||
else return -1;
|
||||
}
|
||||
|
||||
public string getConfigString(string name)
|
||||
{
|
||||
if (config.ContainsKey(name))
|
||||
return config[name].ToString();
|
||||
else return null;
|
||||
}
|
||||
|
||||
public void setConfig(string name, int value)
|
||||
{
|
||||
config[name] = value;
|
||||
string jsonString = JsonSerializer.Serialize(config);
|
||||
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
}
|
||||
|
||||
public void setConfig(string name, string value)
|
||||
{
|
||||
config[name] = value;
|
||||
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class PowerPlan
|
||||
{
|
||||
static void RunCommands(List<string> cmds, string workingDirectory = "")
|
||||
{
|
||||
var process = new Process();
|
||||
var psi = new ProcessStartInfo();
|
||||
psi.FileName = "powershell";
|
||||
psi.RedirectStandardInput = true;
|
||||
psi.RedirectStandardOutput = true;
|
||||
psi.RedirectStandardError = true;
|
||||
psi.UseShellExecute = false;
|
||||
|
||||
psi.CreateNoWindow = true;
|
||||
|
||||
psi.WorkingDirectory = workingDirectory;
|
||||
process.StartInfo = psi;
|
||||
process.Start();
|
||||
process.OutputDataReceived += (sender, e) => { Debug.WriteLine(e.Data); };
|
||||
process.ErrorDataReceived += (sender, e) => { Debug.WriteLine(e.Data); };
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
using (StreamWriter sw = process.StandardInput)
|
||||
{
|
||||
foreach (var cmd in cmds)
|
||||
{
|
||||
sw.WriteLine(cmd);
|
||||
}
|
||||
}
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
public static int getBoostStatus()
|
||||
{
|
||||
List<string> cmds = new List<string>
|
||||
{
|
||||
"$asGuid = [regex]::Match((powercfg /getactivescheme),'(\\{){0,1}[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}(\\}){0,1}').Value",
|
||||
"$statusFull = (powercfg /QUERY $asGuid 54533251-82be-4824-96c1-47b60b740d00 be337238-0d82-4146-a960-4f3749d470c7) -match 'Current AC Power Setting Index'",
|
||||
"[regex]::Match($statusFull,'(0x.{8})').Value"
|
||||
};
|
||||
|
||||
RunCommands(cmds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class NativeMethods
|
||||
public class HardwareMonitor
|
||||
{
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerWriteDCValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
int AcValueIndex);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
out IntPtr AcValueIndex
|
||||
);
|
||||
public float? cpuTemp = -1;
|
||||
public float? gpuTemp = -1;
|
||||
public float? batteryDischarge = -1;
|
||||
public float? batteryCharge = -1;
|
||||
|
||||
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerWriteACValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
int AcValueIndex);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerSetActiveScheme(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid);
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerGetActiveScheme(IntPtr UserPowerKey, out IntPtr ActivePolicyGuid);
|
||||
|
||||
static readonly Guid GUID_CPU = new Guid("54533251-82be-4824-96c1-47b60b740d00");
|
||||
static readonly Guid GUID_BOOST = new Guid("be337238-0d82-4146-a960-4f3749d470c7");
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct DEVMODE
|
||||
public static bool IsAdministrator()
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string dmDeviceName;
|
||||
|
||||
public short dmSpecVersion;
|
||||
public short dmDriverVersion;
|
||||
public short dmSize;
|
||||
public short dmDriverExtra;
|
||||
public int dmFields;
|
||||
public int dmPositionX;
|
||||
public int dmPositionY;
|
||||
public int dmDisplayOrientation;
|
||||
public int dmDisplayFixedOutput;
|
||||
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;
|
||||
};
|
||||
|
||||
[Flags()]
|
||||
public enum DisplaySettingsFlags : int
|
||||
{
|
||||
CDS_UPDATEREGISTRY = 1,
|
||||
CDS_TEST = 2,
|
||||
CDS_FULLSCREEN = 4,
|
||||
CDS_GLOBAL = 8,
|
||||
CDS_SET_PRIMARY = 0x10,
|
||||
CDS_RESET = 0x40000000,
|
||||
CDS_NORESET = 0x10000000
|
||||
return (new WindowsPrincipal(WindowsIdentity.GetCurrent()))
|
||||
.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
// PInvoke declaration for EnumDisplaySettings Win32 API
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int EnumDisplaySettingsEx(
|
||||
string lpszDeviceName,
|
||||
int iModeNum,
|
||||
ref DEVMODE lpDevMode);
|
||||
|
||||
// PInvoke declaration for ChangeDisplaySettings Win32 API
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int ChangeDisplaySettingsEx(
|
||||
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
||||
DisplaySettingsFlags dwflags, IntPtr lParam);
|
||||
|
||||
|
||||
public const int ENUM_CURRENT_SETTINGS = -1;
|
||||
|
||||
public const string laptopScreenName = "\\\\.\\DISPLAY1";
|
||||
|
||||
public static DEVMODE CreateDevmode()
|
||||
public HardwareMonitor()
|
||||
{
|
||||
DEVMODE dm = new DEVMODE();
|
||||
dm.dmDeviceName = new String(new char[32]);
|
||||
dm.dmFormName = new String(new char[32]);
|
||||
dm.dmSize = (short)Marshal.SizeOf(dm);
|
||||
return dm;
|
||||
|
||||
}
|
||||
|
||||
public static Screen FindLaptopScreen()
|
||||
public void ReadSensors()
|
||||
{
|
||||
var screens = Screen.AllScreens;
|
||||
Screen laptopScreen = null;
|
||||
|
||||
foreach (var screen in screens)
|
||||
cpuTemp = -1;
|
||||
gpuTemp = -1;
|
||||
batteryDischarge = -1;
|
||||
|
||||
try
|
||||
{
|
||||
if (screen.DeviceName == laptopScreenName)
|
||||
|
||||
if (cpuTemp < 0)
|
||||
{
|
||||
laptopScreen = screen;
|
||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
ct.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (laptopScreen is null) return null;
|
||||
else return laptopScreen;
|
||||
}
|
||||
if (batteryDischarge < 0)
|
||||
{
|
||||
var ct = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
||||
batteryDischarge = ct.NextValue() / 1000;
|
||||
ct.Dispose();
|
||||
}
|
||||
|
||||
public static int GetRefreshRate()
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
|
||||
Screen laptopScreen = FindLaptopScreen();
|
||||
int frequency = -1;
|
||||
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
} catch
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
Debug.WriteLine("Failed reading sensors");
|
||||
}
|
||||
|
||||
return frequency;
|
||||
|
||||
}
|
||||
|
||||
public static int SetRefreshRate(int frequency = 120)
|
||||
public void StopReading()
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
Screen laptopScreen = FindLaptopScreen();
|
||||
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
dm.dmDisplayFrequency = frequency;
|
||||
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen.DeviceName, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
//computer.Close();
|
||||
}
|
||||
|
||||
static Guid GetActiveScheme()
|
||||
{
|
||||
IntPtr pActiveSchemeGuid;
|
||||
var hr = PowerGetActiveScheme(IntPtr.Zero, out pActiveSchemeGuid);
|
||||
Guid activeSchemeGuid = (Guid)Marshal.PtrToStructure(pActiveSchemeGuid, typeof(Guid));
|
||||
return activeSchemeGuid;
|
||||
}
|
||||
|
||||
public static int GetCPUBoost()
|
||||
{
|
||||
IntPtr AcValueIndex;
|
||||
Guid activeSchemeGuid = GetActiveScheme();
|
||||
|
||||
UInt32 value = PowerReadACValueIndex(IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
GUID_CPU,
|
||||
GUID_BOOST, out AcValueIndex);
|
||||
|
||||
return AcValueIndex.ToInt32();
|
||||
|
||||
}
|
||||
|
||||
public static void SetCPUBoost(int boost = 0)
|
||||
{
|
||||
Guid activeSchemeGuid = GetActiveScheme();
|
||||
|
||||
var hr = PowerWriteACValueIndex(
|
||||
IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
GUID_CPU,
|
||||
GUID_BOOST,
|
||||
boost);
|
||||
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
public static NotifyIcon trayIcon;
|
||||
public static NotifyIcon trayIcon = new NotifyIcon
|
||||
{
|
||||
Text = "G-Helper",
|
||||
Icon = Properties.Resources.standard,
|
||||
Visible = true
|
||||
};
|
||||
|
||||
public static ASUSWmi wmi;
|
||||
public static AppConfig config;
|
||||
public static ASUSWmi wmi = new ASUSWmi();
|
||||
public static AppConfig config = new AppConfig();
|
||||
|
||||
public static SettingsForm settingsForm;
|
||||
public static Startup scheduler;
|
||||
public static SettingsForm settingsForm = new SettingsForm();
|
||||
public static HardwareMonitor hwmonitor = new HardwareMonitor();
|
||||
|
||||
// The main entry point for the application
|
||||
public static void Main()
|
||||
{
|
||||
trayIcon = new NotifyIcon
|
||||
{
|
||||
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.InitBoost();
|
||||
settingsForm.InitAura();
|
||||
|
||||
settingsForm.SetPerformanceMode(config.getConfig("performance_mode"));
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
@@ -515,12 +178,24 @@ namespace GHelper
|
||||
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
||||
settingsForm.VisualiseScreenAuto(config.getConfig("screen_auto"));
|
||||
|
||||
settingsForm.SetStartupCheck(scheduler.IsScheduled());
|
||||
settingsForm.SetStartupCheck(Startup.IsScheduled());
|
||||
|
||||
bool isPlugged = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
|
||||
settingsForm.AutoGPUMode(isPlugged ? 1 : 0);
|
||||
settingsForm.AutoScreen(isPlugged ? 1 : 0);
|
||||
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
|
||||
IntPtr dummy = settingsForm.Handle;
|
||||
|
||||
Application.Run();
|
||||
|
||||
}
|
||||
|
||||
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
}
|
||||
|
||||
static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
@@ -536,10 +211,18 @@ namespace GHelper
|
||||
{
|
||||
case 56: // Rog button
|
||||
case 174: // FN+F5
|
||||
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.CyclePerformanceMode();
|
||||
});
|
||||
|
||||
return;
|
||||
case 179: // FN+F4
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.CycleAuraMode();
|
||||
});
|
||||
return;
|
||||
case 87: // Battery
|
||||
settingsForm.BeginInvoke(delegate
|
||||
@@ -549,7 +232,6 @@ namespace GHelper
|
||||
});
|
||||
return;
|
||||
case 88: // Plugged
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
settingsForm.AutoGPUMode(1);
|
||||
@@ -573,6 +255,8 @@ namespace GHelper
|
||||
settingsForm.Show();
|
||||
settingsForm.Activate();
|
||||
}
|
||||
|
||||
trayIcon.Icon = trayIcon.Icon; // refreshing icon as it get's blurred when screen resolution changes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
Properties/Resources.Designer.cs
generated
20
Properties/Resources.Designer.cs
generated
@@ -80,6 +80,16 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_keyboard_48 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-keyboard-48", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@@ -100,6 +110,16 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_speed_96 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-speed-96", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -121,6 +121,9 @@
|
||||
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -139,4 +142,7 @@
|
||||
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
29
README.md
29
README.md
@@ -1,4 +1,4 @@
|
||||
# G14-Helper
|
||||
# G-Helper (For G14, G15, ROG FLOW, and others)
|
||||
|
||||
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!.
|
||||
|
||||
@@ -10,8 +10,8 @@ Designed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could a
|
||||
|
||||
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)
|
||||
1. Silent (minimal or no fans, 70W PPT total, up to 45W PPT to CPU)
|
||||
2. Balanced (balanced fans, 100W PPT total, up to 45W PPT to CPU)
|
||||
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU)
|
||||
|
||||
## GPU Mode switching
|
||||
@@ -19,15 +19,22 @@ Profiles are **same** as in Armory Crate, including default fan curves
|
||||
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
|
||||
4. **Custom fan profiles** for any mode!
|
||||
|
||||
## 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. FN+F5 an M4 (Rog) keys cycle through Performance modes
|
||||
5. Screen resolution and display overdrive switching
|
||||
6. Run on startup (optional)
|
||||
1. Keyboard backlight control (basic aura modes and colors)
|
||||
2. **Maximum battery charge rate** limit (60% / 80% / 100%) to preserve your battery
|
||||
3. CPU and GPU relative fan speed monitoring
|
||||
4. Automatic switching of Standard/Eco GPU modes when laptop is plugged / unplugged!
|
||||
5. FN+F5 an M4 (Rog) keys cycle through Performance modes
|
||||
6. Screen resolution and display overdrive switching
|
||||
7. CPU turbo boost switching
|
||||
8. CPU & dGPU temperature monitoring in Celsius, battery charge / discharge rates in Watts
|
||||
|
||||
## Things still missing
|
||||
|
||||
1. Anime matrix control
|
||||
|
||||
## How to install
|
||||
|
||||
@@ -35,8 +42,8 @@ Profiles are **same** as in Armory Crate, including default fan curves
|
||||
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.
|
||||
Note: Uses low level ASUS ACPI commands to do switching and doens't require Armory Crate to be isntalled at all.
|
||||
Doesn't require administrator privileges to run (anymore)!
|
||||
|
||||
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.
|
||||
|
||||
|
||||
BIN
Resources/icons8-keyboard-48.png
Normal file
BIN
Resources/icons8-keyboard-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 515 B |
BIN
Resources/icons8-speed-96.png
Normal file
BIN
Resources/icons8-speed-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
841
Settings.Designer.cs
generated
841
Settings.Designer.cs
generated
@@ -28,477 +28,546 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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.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();
|
||||
this.pictureScreen = new System.Windows.Forms.PictureBox();
|
||||
this.labelSreen = new System.Windows.Forms.Label();
|
||||
this.tableScreen = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button120Hz = new System.Windows.Forms.Button();
|
||||
this.button60Hz = new System.Windows.Forms.Button();
|
||||
this.checkScreen = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoost = new System.Windows.Forms.CheckBox();
|
||||
((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();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).BeginInit();
|
||||
this.tableScreen.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
||||
checkStartup = new CheckBox();
|
||||
trackBattery = new TrackBar();
|
||||
labelBatteryTitle = new Label();
|
||||
pictureBattery = new PictureBox();
|
||||
labelGPUFan = new Label();
|
||||
tableGPU = new TableLayoutPanel();
|
||||
buttonUltimate = new Button();
|
||||
buttonStandard = new Button();
|
||||
buttonEco = new Button();
|
||||
labelGPU = new Label();
|
||||
pictureGPU = new PictureBox();
|
||||
labelCPUFan = new Label();
|
||||
tablePerf = new TableLayoutPanel();
|
||||
buttonTurbo = new Button();
|
||||
buttonBalanced = new Button();
|
||||
buttonSilent = new Button();
|
||||
picturePerf = new PictureBox();
|
||||
labelPerf = new Label();
|
||||
checkGPU = new CheckBox();
|
||||
buttonQuit = new Button();
|
||||
pictureScreen = new PictureBox();
|
||||
labelSreen = new Label();
|
||||
tableScreen = new TableLayoutPanel();
|
||||
button120Hz = new Button();
|
||||
button60Hz = new Button();
|
||||
checkScreen = new CheckBox();
|
||||
checkBoost = new CheckBox();
|
||||
pictureBox1 = new PictureBox();
|
||||
label1 = new Label();
|
||||
comboKeyboard = new ComboBox();
|
||||
buttonKeyboardColor = new Button();
|
||||
labelBattery = new Label();
|
||||
buttonFans = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)trackBattery).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBattery).BeginInit();
|
||||
tableGPU.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
||||
tablePerf.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureScreen).BeginInit();
|
||||
tableScreen.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkStartup
|
||||
//
|
||||
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(18, 409);
|
||||
this.checkStartup.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.checkStartup.Name = "checkStartup";
|
||||
this.checkStartup.Size = new System.Drawing.Size(105, 19);
|
||||
this.checkStartup.TabIndex = 2;
|
||||
this.checkStartup.Text = "Run on Startup";
|
||||
this.checkStartup.UseVisualStyleBackColor = true;
|
||||
this.checkStartup.CheckedChanged += new System.EventHandler(this.checkStartup_CheckedChanged);
|
||||
checkStartup.AutoSize = true;
|
||||
checkStartup.Location = new Point(20, 508);
|
||||
checkStartup.Margin = new Padding(2, 1, 2, 1);
|
||||
checkStartup.Name = "checkStartup";
|
||||
checkStartup.Size = new Size(105, 19);
|
||||
checkStartup.TabIndex = 2;
|
||||
checkStartup.Text = "Run on Startup";
|
||||
checkStartup.UseVisualStyleBackColor = true;
|
||||
checkStartup.CheckedChanged += checkStartup_CheckedChanged;
|
||||
//
|
||||
// trackBattery
|
||||
//
|
||||
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(12, 359);
|
||||
this.trackBattery.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.trackBattery.Maximum = 100;
|
||||
this.trackBattery.Minimum = 50;
|
||||
this.trackBattery.Name = "trackBattery";
|
||||
this.trackBattery.Size = new System.Drawing.Size(361, 45);
|
||||
this.trackBattery.SmallChange = 10;
|
||||
this.trackBattery.TabIndex = 3;
|
||||
this.trackBattery.TickFrequency = 10;
|
||||
this.trackBattery.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
||||
this.trackBattery.Value = 100;
|
||||
trackBattery.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
trackBattery.LargeChange = 20;
|
||||
trackBattery.Location = new Point(10, 454);
|
||||
trackBattery.Margin = new Padding(2, 1, 2, 1);
|
||||
trackBattery.Maximum = 100;
|
||||
trackBattery.Minimum = 50;
|
||||
trackBattery.Name = "trackBattery";
|
||||
trackBattery.Size = new Size(338, 45);
|
||||
trackBattery.SmallChange = 10;
|
||||
trackBattery.TabIndex = 3;
|
||||
trackBattery.TickFrequency = 10;
|
||||
trackBattery.TickStyle = TickStyle.TopLeft;
|
||||
trackBattery.Value = 100;
|
||||
//
|
||||
// labelBattery
|
||||
// labelBatteryTitle
|
||||
//
|
||||
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(45, 339);
|
||||
this.labelBattery.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelBattery.Name = "labelBattery";
|
||||
this.labelBattery.Size = new System.Drawing.Size(122, 15);
|
||||
this.labelBattery.TabIndex = 4;
|
||||
this.labelBattery.Text = "Battery Charge Limit";
|
||||
//
|
||||
// labelBatteryLimit
|
||||
//
|
||||
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(331, 338);
|
||||
this.labelBatteryLimit.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelBatteryLimit.Name = "labelBatteryLimit";
|
||||
this.labelBatteryLimit.Size = new System.Drawing.Size(35, 15);
|
||||
this.labelBatteryLimit.TabIndex = 5;
|
||||
this.labelBatteryLimit.Text = "100%";
|
||||
labelBatteryTitle.AutoSize = true;
|
||||
labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBatteryTitle.Location = new Point(38, 435);
|
||||
labelBatteryTitle.Margin = new Padding(2, 0, 2, 0);
|
||||
labelBatteryTitle.Name = "labelBatteryTitle";
|
||||
labelBatteryTitle.Size = new Size(122, 15);
|
||||
labelBatteryTitle.TabIndex = 4;
|
||||
labelBatteryTitle.Text = "Battery Charge Limit";
|
||||
//
|
||||
// pictureBattery
|
||||
//
|
||||
this.pictureBattery.BackgroundImage = global::GHelper.Properties.Resources.icons8_charging_battery_48;
|
||||
this.pictureBattery.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureBattery.Location = new System.Drawing.Point(17, 335);
|
||||
this.pictureBattery.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.pictureBattery.Name = "pictureBattery";
|
||||
this.pictureBattery.Size = new System.Drawing.Size(26, 22);
|
||||
this.pictureBattery.TabIndex = 6;
|
||||
this.pictureBattery.TabStop = false;
|
||||
pictureBattery.BackgroundImage = (Image)resources.GetObject("pictureBattery.BackgroundImage");
|
||||
pictureBattery.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureBattery.Location = new Point(16, 434);
|
||||
pictureBattery.Margin = new Padding(2, 1, 2, 1);
|
||||
pictureBattery.Name = "pictureBattery";
|
||||
pictureBattery.Size = new Size(18, 19);
|
||||
pictureBattery.TabIndex = 6;
|
||||
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(293, 123);
|
||||
this.labelGPUFan.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelGPUFan.Name = "labelGPUFan";
|
||||
this.labelGPUFan.Size = new System.Drawing.Size(77, 15);
|
||||
this.labelGPUFan.TabIndex = 8;
|
||||
this.labelGPUFan.Text = "GPU Fan : 0%";
|
||||
labelGPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelGPUFan.Location = new Point(205, 131);
|
||||
labelGPUFan.Margin = new Padding(2, 0, 2, 0);
|
||||
labelGPUFan.Name = "labelGPUFan";
|
||||
labelGPUFan.Size = new Size(138, 16);
|
||||
labelGPUFan.TabIndex = 8;
|
||||
labelGPUFan.Text = "GPU Fan : 0%";
|
||||
labelGPUFan.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// 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));
|
||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
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.Location = new System.Drawing.Point(12, 142);
|
||||
this.tableGPU.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.tableGPU.Name = "tableGPU";
|
||||
this.tableGPU.RowCount = 1;
|
||||
this.tableGPU.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
||||
this.tableGPU.Size = new System.Drawing.Size(361, 50);
|
||||
this.tableGPU.TabIndex = 7;
|
||||
tableGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableGPU.ColumnCount = 3;
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableGPU.Controls.Add(buttonUltimate, 2, 0);
|
||||
tableGPU.Controls.Add(buttonStandard, 1, 0);
|
||||
tableGPU.Controls.Add(buttonEco, 0, 0);
|
||||
tableGPU.Location = new Point(11, 152);
|
||||
tableGPU.Margin = new Padding(2, 1, 2, 1);
|
||||
tableGPU.Name = "tableGPU";
|
||||
tableGPU.RowCount = 1;
|
||||
tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 54F));
|
||||
tableGPU.Size = new Size(338, 54);
|
||||
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.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonUltimate.Location = new System.Drawing.Point(245, 5);
|
||||
this.buttonUltimate.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonUltimate.Name = "buttonUltimate";
|
||||
this.buttonUltimate.Size = new System.Drawing.Size(111, 40);
|
||||
this.buttonUltimate.TabIndex = 2;
|
||||
this.buttonUltimate.Text = "Ultimate";
|
||||
this.buttonUltimate.UseVisualStyleBackColor = false;
|
||||
buttonUltimate.BackColor = SystemColors.ControlLightLight;
|
||||
buttonUltimate.Dock = DockStyle.Fill;
|
||||
buttonUltimate.FlatAppearance.BorderSize = 0;
|
||||
buttonUltimate.FlatStyle = FlatStyle.Flat;
|
||||
buttonUltimate.Location = new Point(228, 6);
|
||||
buttonUltimate.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonUltimate.Name = "buttonUltimate";
|
||||
buttonUltimate.Size = new Size(106, 42);
|
||||
buttonUltimate.TabIndex = 2;
|
||||
buttonUltimate.Text = "Ultimate";
|
||||
buttonUltimate.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonStandard
|
||||
//
|
||||
this.buttonStandard.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.buttonStandard.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buttonStandard.FlatAppearance.BorderSize = 0;
|
||||
this.buttonStandard.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonStandard.Location = new System.Drawing.Point(125, 5);
|
||||
this.buttonStandard.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonStandard.Name = "buttonStandard";
|
||||
this.buttonStandard.Size = new System.Drawing.Size(110, 40);
|
||||
this.buttonStandard.TabIndex = 1;
|
||||
this.buttonStandard.Text = "Standard";
|
||||
this.buttonStandard.UseVisualStyleBackColor = false;
|
||||
buttonStandard.BackColor = SystemColors.ControlLightLight;
|
||||
buttonStandard.Dock = DockStyle.Fill;
|
||||
buttonStandard.FlatAppearance.BorderSize = 0;
|
||||
buttonStandard.FlatStyle = FlatStyle.Flat;
|
||||
buttonStandard.Location = new Point(116, 6);
|
||||
buttonStandard.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonStandard.Name = "buttonStandard";
|
||||
buttonStandard.Size = new Size(104, 42);
|
||||
buttonStandard.TabIndex = 1;
|
||||
buttonStandard.Text = "Standard";
|
||||
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(5, 5);
|
||||
this.buttonEco.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonEco.Name = "buttonEco";
|
||||
this.buttonEco.Size = new System.Drawing.Size(110, 40);
|
||||
this.buttonEco.TabIndex = 0;
|
||||
this.buttonEco.Text = "Eco";
|
||||
this.buttonEco.UseVisualStyleBackColor = false;
|
||||
buttonEco.BackColor = SystemColors.ControlLightLight;
|
||||
buttonEco.CausesValidation = false;
|
||||
buttonEco.Dock = DockStyle.Fill;
|
||||
buttonEco.FlatAppearance.BorderSize = 0;
|
||||
buttonEco.FlatStyle = FlatStyle.Flat;
|
||||
buttonEco.Location = new Point(4, 6);
|
||||
buttonEco.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonEco.Name = "buttonEco";
|
||||
buttonEco.Size = new Size(104, 42);
|
||||
buttonEco.TabIndex = 0;
|
||||
buttonEco.Text = "Eco";
|
||||
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(45, 124);
|
||||
this.labelGPU.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelGPU.Name = "labelGPU";
|
||||
this.labelGPU.Size = new System.Drawing.Size(67, 15);
|
||||
this.labelGPU.TabIndex = 9;
|
||||
this.labelGPU.Text = "GPU Mode";
|
||||
labelGPU.AutoSize = true;
|
||||
labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelGPU.Location = new Point(38, 132);
|
||||
labelGPU.Margin = new Padding(2, 0, 2, 0);
|
||||
labelGPU.Name = "labelGPU";
|
||||
labelGPU.Size = new Size(67, 15);
|
||||
labelGPU.TabIndex = 9;
|
||||
labelGPU.Text = "GPU Mode";
|
||||
//
|
||||
// pictureGPU
|
||||
//
|
||||
this.pictureGPU.BackgroundImage = global::GHelper.Properties.Resources.icons8_video_card_48;
|
||||
this.pictureGPU.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureGPU.Location = new System.Drawing.Point(17, 120);
|
||||
this.pictureGPU.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.pictureGPU.Name = "pictureGPU";
|
||||
this.pictureGPU.Size = new System.Drawing.Size(26, 22);
|
||||
this.pictureGPU.TabIndex = 10;
|
||||
this.pictureGPU.TabStop = false;
|
||||
pictureGPU.BackgroundImage = (Image)resources.GetObject("pictureGPU.BackgroundImage");
|
||||
pictureGPU.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureGPU.Location = new Point(16, 131);
|
||||
pictureGPU.Margin = new Padding(2, 1, 2, 1);
|
||||
pictureGPU.Name = "pictureGPU";
|
||||
pictureGPU.Size = new Size(18, 19);
|
||||
pictureGPU.TabIndex = 10;
|
||||
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(293, 18);
|
||||
this.labelCPUFan.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelCPUFan.Name = "labelCPUFan";
|
||||
this.labelCPUFan.Size = new System.Drawing.Size(77, 15);
|
||||
this.labelCPUFan.TabIndex = 12;
|
||||
this.labelCPUFan.Text = "CPU Fan : 0%";
|
||||
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelCPUFan.Location = new Point(205, 19);
|
||||
labelCPUFan.Margin = new Padding(2, 0, 2, 0);
|
||||
labelCPUFan.Name = "labelCPUFan";
|
||||
labelCPUFan.Size = new Size(138, 16);
|
||||
labelCPUFan.TabIndex = 12;
|
||||
labelCPUFan.Text = "CPU Fan : 0%";
|
||||
labelCPUFan.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// 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(12, 37);
|
||||
this.tablePerf.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.tablePerf.Name = "tablePerf";
|
||||
this.tablePerf.RowCount = 1;
|
||||
this.tablePerf.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
||||
this.tablePerf.Size = new System.Drawing.Size(361, 50);
|
||||
this.tablePerf.TabIndex = 11;
|
||||
tablePerf.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tablePerf.ColumnCount = 3;
|
||||
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tablePerf.Controls.Add(buttonTurbo, 2, 0);
|
||||
tablePerf.Controls.Add(buttonBalanced, 1, 0);
|
||||
tablePerf.Controls.Add(buttonSilent, 0, 0);
|
||||
tablePerf.Location = new Point(11, 38);
|
||||
tablePerf.Margin = new Padding(2, 1, 2, 1);
|
||||
tablePerf.Name = "tablePerf";
|
||||
tablePerf.RowCount = 1;
|
||||
tablePerf.RowStyles.Add(new RowStyle(SizeType.Absolute, 54F));
|
||||
tablePerf.Size = new Size(338, 54);
|
||||
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(245, 5);
|
||||
this.buttonTurbo.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonTurbo.Name = "buttonTurbo";
|
||||
this.buttonTurbo.Size = new System.Drawing.Size(111, 40);
|
||||
this.buttonTurbo.TabIndex = 2;
|
||||
this.buttonTurbo.Text = "Turbo";
|
||||
this.buttonTurbo.UseVisualStyleBackColor = false;
|
||||
buttonTurbo.BackColor = SystemColors.ControlLightLight;
|
||||
buttonTurbo.Dock = DockStyle.Fill;
|
||||
buttonTurbo.FlatAppearance.BorderColor = Color.FromArgb(192, 0, 0);
|
||||
buttonTurbo.FlatAppearance.BorderSize = 0;
|
||||
buttonTurbo.FlatStyle = FlatStyle.Flat;
|
||||
buttonTurbo.Location = new Point(228, 6);
|
||||
buttonTurbo.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonTurbo.Name = "buttonTurbo";
|
||||
buttonTurbo.Size = new Size(106, 42);
|
||||
buttonTurbo.TabIndex = 2;
|
||||
buttonTurbo.Text = "Turbo";
|
||||
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(125, 5);
|
||||
this.buttonBalanced.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonBalanced.Name = "buttonBalanced";
|
||||
this.buttonBalanced.Size = new System.Drawing.Size(110, 40);
|
||||
this.buttonBalanced.TabIndex = 1;
|
||||
this.buttonBalanced.Text = "Balanced";
|
||||
this.buttonBalanced.UseVisualStyleBackColor = false;
|
||||
buttonBalanced.BackColor = SystemColors.ControlLightLight;
|
||||
buttonBalanced.Dock = DockStyle.Fill;
|
||||
buttonBalanced.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 192);
|
||||
buttonBalanced.FlatAppearance.BorderSize = 0;
|
||||
buttonBalanced.FlatStyle = FlatStyle.Flat;
|
||||
buttonBalanced.Location = new Point(116, 6);
|
||||
buttonBalanced.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonBalanced.Name = "buttonBalanced";
|
||||
buttonBalanced.Size = new Size(104, 42);
|
||||
buttonBalanced.TabIndex = 1;
|
||||
buttonBalanced.Text = "Balanced";
|
||||
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(5, 5);
|
||||
this.buttonSilent.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.buttonSilent.Name = "buttonSilent";
|
||||
this.buttonSilent.Size = new System.Drawing.Size(110, 40);
|
||||
this.buttonSilent.TabIndex = 0;
|
||||
this.buttonSilent.Text = "Silent";
|
||||
this.buttonSilent.UseVisualStyleBackColor = false;
|
||||
buttonSilent.BackColor = SystemColors.ControlLightLight;
|
||||
buttonSilent.CausesValidation = false;
|
||||
buttonSilent.Dock = DockStyle.Fill;
|
||||
buttonSilent.FlatAppearance.BorderColor = Color.FromArgb(0, 192, 192);
|
||||
buttonSilent.FlatAppearance.BorderSize = 0;
|
||||
buttonSilent.FlatStyle = FlatStyle.Flat;
|
||||
buttonSilent.Location = new Point(4, 6);
|
||||
buttonSilent.Margin = new Padding(4, 6, 4, 6);
|
||||
buttonSilent.Name = "buttonSilent";
|
||||
buttonSilent.Size = new Size(104, 42);
|
||||
buttonSilent.TabIndex = 0;
|
||||
buttonSilent.Text = "Silent";
|
||||
buttonSilent.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// picturePerf
|
||||
//
|
||||
this.picturePerf.BackgroundImage = global::GHelper.Properties.Resources.icons8_speed_48;
|
||||
this.picturePerf.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.picturePerf.InitialImage = null;
|
||||
this.picturePerf.Location = new System.Drawing.Point(17, 15);
|
||||
this.picturePerf.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.picturePerf.Name = "picturePerf";
|
||||
this.picturePerf.Size = new System.Drawing.Size(26, 22);
|
||||
this.picturePerf.TabIndex = 14;
|
||||
this.picturePerf.TabStop = false;
|
||||
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
||||
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
picturePerf.InitialImage = null;
|
||||
picturePerf.Location = new Point(16, 18);
|
||||
picturePerf.Margin = new Padding(2, 1, 2, 1);
|
||||
picturePerf.Name = "picturePerf";
|
||||
picturePerf.Size = new Size(18, 19);
|
||||
picturePerf.TabIndex = 14;
|
||||
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(45, 19);
|
||||
this.labelPerf.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelPerf.Name = "labelPerf";
|
||||
this.labelPerf.Size = new System.Drawing.Size(115, 15);
|
||||
this.labelPerf.TabIndex = 13;
|
||||
this.labelPerf.Text = "Performance Mode";
|
||||
labelPerf.AutoSize = true;
|
||||
labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelPerf.Location = new Point(38, 19);
|
||||
labelPerf.Margin = new Padding(2, 0, 2, 0);
|
||||
labelPerf.Name = "labelPerf";
|
||||
labelPerf.Size = new Size(115, 15);
|
||||
labelPerf.TabIndex = 13;
|
||||
labelPerf.Text = "Performance Mode";
|
||||
//
|
||||
// checkGPU
|
||||
//
|
||||
this.checkGPU.AutoSize = true;
|
||||
this.checkGPU.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.checkGPU.Location = new System.Drawing.Point(18, 192);
|
||||
this.checkGPU.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.checkGPU.Name = "checkGPU";
|
||||
this.checkGPU.Size = new System.Drawing.Size(273, 19);
|
||||
this.checkGPU.TabIndex = 15;
|
||||
this.checkGPU.Text = "Set Eco on battery and Standard when plugged";
|
||||
this.checkGPU.UseVisualStyleBackColor = true;
|
||||
this.checkGPU.CheckedChanged += new System.EventHandler(this.checkGPU_CheckedChanged);
|
||||
checkGPU.AutoSize = true;
|
||||
checkGPU.ForeColor = SystemColors.GrayText;
|
||||
checkGPU.Location = new Point(16, 206);
|
||||
checkGPU.Margin = new Padding(2, 1, 2, 1);
|
||||
checkGPU.Name = "checkGPU";
|
||||
checkGPU.Size = new Size(273, 19);
|
||||
checkGPU.TabIndex = 15;
|
||||
checkGPU.Text = "Set Eco on battery and Standard when plugged";
|
||||
checkGPU.UseVisualStyleBackColor = true;
|
||||
checkGPU.CheckedChanged += 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(307, 409);
|
||||
this.buttonQuit.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.buttonQuit.Name = "buttonQuit";
|
||||
this.buttonQuit.Size = new System.Drawing.Size(65, 22);
|
||||
this.buttonQuit.TabIndex = 16;
|
||||
this.buttonQuit.Text = "Quit";
|
||||
this.buttonQuit.UseVisualStyleBackColor = false;
|
||||
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonQuit.BackColor = SystemColors.ButtonFace;
|
||||
buttonQuit.Location = new Point(288, 504);
|
||||
buttonQuit.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonQuit.Name = "buttonQuit";
|
||||
buttonQuit.Size = new Size(60, 24);
|
||||
buttonQuit.TabIndex = 16;
|
||||
buttonQuit.Text = "Quit";
|
||||
buttonQuit.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// pictureScreen
|
||||
//
|
||||
this.pictureScreen.BackgroundImage = global::GHelper.Properties.Resources.icons8_laptop_48;
|
||||
this.pictureScreen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureScreen.Location = new System.Drawing.Point(17, 229);
|
||||
this.pictureScreen.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.pictureScreen.Name = "pictureScreen";
|
||||
this.pictureScreen.Size = new System.Drawing.Size(26, 22);
|
||||
this.pictureScreen.TabIndex = 18;
|
||||
this.pictureScreen.TabStop = false;
|
||||
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
|
||||
pictureScreen.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureScreen.Location = new Point(16, 248);
|
||||
pictureScreen.Margin = new Padding(2, 1, 2, 1);
|
||||
pictureScreen.Name = "pictureScreen";
|
||||
pictureScreen.Size = new Size(18, 19);
|
||||
pictureScreen.TabIndex = 18;
|
||||
pictureScreen.TabStop = false;
|
||||
//
|
||||
// labelSreen
|
||||
//
|
||||
this.labelSreen.AutoSize = true;
|
||||
this.labelSreen.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.labelSreen.Location = new System.Drawing.Point(45, 233);
|
||||
this.labelSreen.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.labelSreen.Name = "labelSreen";
|
||||
this.labelSreen.Size = new System.Drawing.Size(87, 15);
|
||||
this.labelSreen.TabIndex = 17;
|
||||
this.labelSreen.Text = "Laptop Screen";
|
||||
labelSreen.AutoSize = true;
|
||||
labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelSreen.Location = new Point(38, 248);
|
||||
labelSreen.Margin = new Padding(2, 0, 2, 0);
|
||||
labelSreen.Name = "labelSreen";
|
||||
labelSreen.Size = new Size(87, 15);
|
||||
labelSreen.TabIndex = 17;
|
||||
labelSreen.Text = "Laptop Screen";
|
||||
//
|
||||
// tableScreen
|
||||
//
|
||||
this.tableScreen.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tableScreen.ColumnCount = 3;
|
||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableScreen.Controls.Add(this.button120Hz, 1, 0);
|
||||
this.tableScreen.Controls.Add(this.button60Hz, 0, 0);
|
||||
this.tableScreen.Location = new System.Drawing.Point(12, 251);
|
||||
this.tableScreen.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.tableScreen.Name = "tableScreen";
|
||||
this.tableScreen.RowCount = 1;
|
||||
this.tableScreen.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
||||
this.tableScreen.Size = new System.Drawing.Size(361, 48);
|
||||
this.tableScreen.TabIndex = 19;
|
||||
tableScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableScreen.ColumnCount = 3;
|
||||
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||
tableScreen.Controls.Add(button120Hz, 1, 0);
|
||||
tableScreen.Controls.Add(button60Hz, 0, 0);
|
||||
tableScreen.Location = new Point(11, 268);
|
||||
tableScreen.Margin = new Padding(2, 1, 2, 1);
|
||||
tableScreen.Name = "tableScreen";
|
||||
tableScreen.RowCount = 1;
|
||||
tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 54F));
|
||||
tableScreen.Size = new Size(338, 54);
|
||||
tableScreen.TabIndex = 19;
|
||||
//
|
||||
// button120Hz
|
||||
//
|
||||
this.button120Hz.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.button120Hz.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button120Hz.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveBorder;
|
||||
this.button120Hz.FlatAppearance.BorderSize = 0;
|
||||
this.button120Hz.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button120Hz.Location = new System.Drawing.Point(125, 5);
|
||||
this.button120Hz.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.button120Hz.Name = "button120Hz";
|
||||
this.button120Hz.Size = new System.Drawing.Size(110, 40);
|
||||
this.button120Hz.TabIndex = 1;
|
||||
this.button120Hz.Text = "120Hz + OD";
|
||||
this.button120Hz.UseVisualStyleBackColor = false;
|
||||
button120Hz.BackColor = SystemColors.ControlLightLight;
|
||||
button120Hz.Dock = DockStyle.Fill;
|
||||
button120Hz.FlatAppearance.BorderColor = SystemColors.ActiveBorder;
|
||||
button120Hz.FlatAppearance.BorderSize = 0;
|
||||
button120Hz.FlatStyle = FlatStyle.Flat;
|
||||
button120Hz.Location = new Point(116, 6);
|
||||
button120Hz.Margin = new Padding(4, 6, 4, 6);
|
||||
button120Hz.Name = "button120Hz";
|
||||
button120Hz.Size = new Size(104, 42);
|
||||
button120Hz.TabIndex = 1;
|
||||
button120Hz.Text = "120Hz + OD";
|
||||
button120Hz.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// button60Hz
|
||||
//
|
||||
this.button60Hz.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.button60Hz.CausesValidation = false;
|
||||
this.button60Hz.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button60Hz.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveBorder;
|
||||
this.button60Hz.FlatAppearance.BorderSize = 0;
|
||||
this.button60Hz.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button60Hz.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.button60Hz.Location = new System.Drawing.Point(5, 5);
|
||||
this.button60Hz.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.button60Hz.Name = "button60Hz";
|
||||
this.button60Hz.Size = new System.Drawing.Size(110, 40);
|
||||
this.button60Hz.TabIndex = 0;
|
||||
this.button60Hz.Text = "60Hz";
|
||||
this.button60Hz.UseVisualStyleBackColor = false;
|
||||
button60Hz.BackColor = SystemColors.ControlLightLight;
|
||||
button60Hz.CausesValidation = false;
|
||||
button60Hz.Dock = DockStyle.Fill;
|
||||
button60Hz.FlatAppearance.BorderColor = SystemColors.ActiveBorder;
|
||||
button60Hz.FlatAppearance.BorderSize = 0;
|
||||
button60Hz.FlatStyle = FlatStyle.Flat;
|
||||
button60Hz.ForeColor = SystemColors.ControlText;
|
||||
button60Hz.Location = new Point(4, 6);
|
||||
button60Hz.Margin = new Padding(4, 6, 4, 6);
|
||||
button60Hz.Name = "button60Hz";
|
||||
button60Hz.Size = new Size(104, 42);
|
||||
button60Hz.TabIndex = 0;
|
||||
button60Hz.Text = "60Hz";
|
||||
button60Hz.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// checkScreen
|
||||
//
|
||||
this.checkScreen.AutoSize = true;
|
||||
this.checkScreen.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.checkScreen.Location = new System.Drawing.Point(18, 299);
|
||||
this.checkScreen.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.checkScreen.Name = "checkScreen";
|
||||
this.checkScreen.Size = new System.Drawing.Size(261, 19);
|
||||
this.checkScreen.TabIndex = 20;
|
||||
this.checkScreen.Text = "Set 60Hz on battery, and back when plugged";
|
||||
this.checkScreen.UseVisualStyleBackColor = true;
|
||||
checkScreen.AutoSize = true;
|
||||
checkScreen.ForeColor = SystemColors.GrayText;
|
||||
checkScreen.Location = new Point(16, 322);
|
||||
checkScreen.Margin = new Padding(2, 1, 2, 1);
|
||||
checkScreen.Name = "checkScreen";
|
||||
checkScreen.Size = new Size(261, 19);
|
||||
checkScreen.TabIndex = 20;
|
||||
checkScreen.Text = "Set 60Hz on battery, and back when plugged";
|
||||
checkScreen.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoost
|
||||
//
|
||||
this.checkBoost.AutoSize = true;
|
||||
this.checkBoost.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.checkBoost.Location = new System.Drawing.Point(18, 87);
|
||||
this.checkBoost.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.checkBoost.Name = "checkBoost";
|
||||
this.checkBoost.Size = new System.Drawing.Size(127, 19);
|
||||
this.checkBoost.TabIndex = 21;
|
||||
this.checkBoost.Text = "CPU Boost enabled";
|
||||
this.checkBoost.UseVisualStyleBackColor = true;
|
||||
checkBoost.AutoSize = true;
|
||||
checkBoost.ForeColor = SystemColors.GrayText;
|
||||
checkBoost.Location = new Point(16, 92);
|
||||
checkBoost.Margin = new Padding(2, 1, 2, 1);
|
||||
checkBoost.Name = "checkBoost";
|
||||
checkBoost.Size = new Size(161, 19);
|
||||
checkBoost.TabIndex = 21;
|
||||
checkBoost.Text = "CPU Turbo Boost enabled";
|
||||
checkBoost.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.BackgroundImage = Properties.Resources.icons8_keyboard_48;
|
||||
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureBox1.Location = new Point(16, 362);
|
||||
pictureBox1.Margin = new Padding(2, 1, 2, 1);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(18, 18);
|
||||
pictureBox1.TabIndex = 23;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
label1.Location = new Point(38, 362);
|
||||
label1.Margin = new Padding(2, 0, 2, 0);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(101, 15);
|
||||
label1.TabIndex = 22;
|
||||
label1.Text = "Laptop Keyboard";
|
||||
//
|
||||
// comboKeyboard
|
||||
//
|
||||
comboKeyboard.FlatStyle = FlatStyle.Flat;
|
||||
comboKeyboard.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboKeyboard.FormattingEnabled = true;
|
||||
comboKeyboard.ItemHeight = 17;
|
||||
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Strobe", "Rainbow" });
|
||||
comboKeyboard.Location = new Point(18, 388);
|
||||
comboKeyboard.Margin = new Padding(0);
|
||||
comboKeyboard.Name = "comboKeyboard";
|
||||
comboKeyboard.Size = new Size(102, 25);
|
||||
comboKeyboard.TabIndex = 24;
|
||||
comboKeyboard.TabStop = false;
|
||||
//
|
||||
// buttonKeyboardColor
|
||||
//
|
||||
buttonKeyboardColor.AutoSize = true;
|
||||
buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight;
|
||||
buttonKeyboardColor.FlatAppearance.BorderColor = Color.Red;
|
||||
buttonKeyboardColor.FlatAppearance.BorderSize = 2;
|
||||
buttonKeyboardColor.FlatStyle = FlatStyle.Flat;
|
||||
buttonKeyboardColor.ForeColor = SystemColors.ControlText;
|
||||
buttonKeyboardColor.Location = new Point(128, 388);
|
||||
buttonKeyboardColor.Margin = new Padding(0);
|
||||
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
||||
buttonKeyboardColor.Size = new Size(106, 29);
|
||||
buttonKeyboardColor.TabIndex = 25;
|
||||
buttonKeyboardColor.Text = "Color";
|
||||
buttonKeyboardColor.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// labelBattery
|
||||
//
|
||||
labelBattery.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelBattery.Location = new Point(205, 434);
|
||||
labelBattery.Margin = new Padding(2, 0, 2, 0);
|
||||
labelBattery.Name = "labelBattery";
|
||||
labelBattery.Size = new Size(138, 16);
|
||||
labelBattery.TabIndex = 27;
|
||||
labelBattery.Text = " ";
|
||||
labelBattery.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// buttonFans
|
||||
//
|
||||
buttonFans.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonFans.BackColor = SystemColors.ButtonFace;
|
||||
buttonFans.Location = new Point(263, 93);
|
||||
buttonFans.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonFans.Name = "buttonFans";
|
||||
buttonFans.Size = new Size(82, 24);
|
||||
buttonFans.TabIndex = 28;
|
||||
buttonFans.Text = "Fan Profile";
|
||||
buttonFans.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(390, 441);
|
||||
this.Controls.Add(this.checkBoost);
|
||||
this.Controls.Add(this.checkScreen);
|
||||
this.Controls.Add(this.tableScreen);
|
||||
this.Controls.Add(this.pictureScreen);
|
||||
this.Controls.Add(this.labelSreen);
|
||||
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.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.MaximizeBox = false;
|
||||
this.MdiChildrenMinimizedAnchorBottom = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SettingsForm";
|
||||
this.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "G14 Helper";
|
||||
this.Load += new System.EventHandler(this.Settings_Load);
|
||||
((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();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).EndInit();
|
||||
this.tableScreen.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
AutoScaleDimensions = new SizeF(96F, 96F);
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
ClientSize = new Size(365, 543);
|
||||
Controls.Add(buttonFans);
|
||||
Controls.Add(labelBattery);
|
||||
Controls.Add(buttonKeyboardColor);
|
||||
Controls.Add(comboKeyboard);
|
||||
Controls.Add(pictureBox1);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(checkBoost);
|
||||
Controls.Add(checkScreen);
|
||||
Controls.Add(tableScreen);
|
||||
Controls.Add(pictureScreen);
|
||||
Controls.Add(labelSreen);
|
||||
Controls.Add(buttonQuit);
|
||||
Controls.Add(checkGPU);
|
||||
Controls.Add(picturePerf);
|
||||
Controls.Add(labelPerf);
|
||||
Controls.Add(labelCPUFan);
|
||||
Controls.Add(tablePerf);
|
||||
Controls.Add(pictureGPU);
|
||||
Controls.Add(labelGPU);
|
||||
Controls.Add(labelGPUFan);
|
||||
Controls.Add(tableGPU);
|
||||
Controls.Add(pictureBattery);
|
||||
Controls.Add(labelBatteryTitle);
|
||||
Controls.Add(trackBattery);
|
||||
Controls.Add(checkStartup);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
Margin = new Padding(2, 1, 2, 1);
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
Name = "SettingsForm";
|
||||
Padding = new Padding(4, 6, 4, 6);
|
||||
ShowIcon = false;
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "G-Helper";
|
||||
Load += Settings_Load;
|
||||
((System.ComponentModel.ISupportInitialize)trackBattery).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
|
||||
tableGPU.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
||||
tablePerf.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)picturePerf).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureScreen).EndInit();
|
||||
tableScreen.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
private CheckBox checkStartup;
|
||||
private TrackBar trackBattery;
|
||||
private Label labelBattery;
|
||||
private Label labelBatteryLimit;
|
||||
private Label labelBatteryTitle;
|
||||
private PictureBox pictureBattery;
|
||||
private Label labelGPUFan;
|
||||
private TableLayoutPanel tableGPU;
|
||||
@@ -523,5 +592,11 @@
|
||||
private Button button60Hz;
|
||||
private CheckBox checkScreen;
|
||||
private CheckBox checkBoost;
|
||||
private PictureBox pictureBox1;
|
||||
private Label label1;
|
||||
private ComboBox comboKeyboard;
|
||||
private Button buttonKeyboardColor;
|
||||
private Label labelBattery;
|
||||
private Button buttonFans;
|
||||
}
|
||||
}
|
||||
263
Settings.cs
263
Settings.cs
@@ -1,9 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Timers;
|
||||
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
|
||||
@@ -16,6 +17,10 @@ namespace GHelper
|
||||
|
||||
static System.Timers.Timer aTimer = default!;
|
||||
|
||||
public string perfName;
|
||||
|
||||
Fans fans;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
|
||||
@@ -52,13 +57,128 @@ namespace GHelper
|
||||
|
||||
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
|
||||
|
||||
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboKeyboard.SelectedIndex = 0;
|
||||
|
||||
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
|
||||
|
||||
buttonKeyboardColor.Click += ButtonKeyboardColor_Click;
|
||||
|
||||
buttonFans.Click += ButtonFans_Click;
|
||||
|
||||
SetTimer();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ButtonFans_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (fans == null || fans.Text == "")
|
||||
{
|
||||
fans = new Fans();
|
||||
fans.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
fans.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
Button but = (Button)sender;
|
||||
|
||||
ColorDialog colorDlg = new ColorDialog();
|
||||
colorDlg.AllowFullOpen = false;
|
||||
colorDlg.Color = but.FlatAppearance.BorderColor;
|
||||
|
||||
if (colorDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SetAuraColor(colorDlg.Color);
|
||||
}
|
||||
}
|
||||
|
||||
public void InitAura()
|
||||
{
|
||||
int mode = Program.config.getConfig("aura_mode");
|
||||
int colorCode = Program.config.getConfig("aura_color");
|
||||
int speed = Program.config.getConfig("aura_speed");
|
||||
|
||||
Color color = Color.FromArgb(255, 255, 255);
|
||||
|
||||
if (mode == -1)
|
||||
mode = 0;
|
||||
|
||||
if (colorCode != -1)
|
||||
color = Color.FromArgb(colorCode);
|
||||
|
||||
|
||||
SetAuraColor(color, false);
|
||||
SetAuraMode(mode, false);
|
||||
|
||||
Aura.Mode = mode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SetAuraColor(Color color, bool apply = true)
|
||||
{
|
||||
Aura.Color1 = color;
|
||||
Program.config.setConfig("aura_color", color.ToArgb());
|
||||
|
||||
if (apply)
|
||||
Aura.ApplyAura();
|
||||
|
||||
buttonKeyboardColor.FlatAppearance.BorderColor = color;
|
||||
}
|
||||
|
||||
public void SetAuraMode(int mode = 0, bool apply = true)
|
||||
{
|
||||
|
||||
//Debug.WriteLine(mode);
|
||||
|
||||
if (mode > 3) mode = 0;
|
||||
|
||||
if (Aura.Mode == mode) return; // same mode
|
||||
|
||||
Aura.Mode = mode;
|
||||
Program.config.setConfig("aura_mode", mode);
|
||||
|
||||
comboKeyboard.SelectedValueChanged -= ComboKeyboard_SelectedValueChanged;
|
||||
comboKeyboard.SelectedIndex = mode;
|
||||
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
|
||||
|
||||
if (apply)
|
||||
Aura.ApplyAura();
|
||||
|
||||
}
|
||||
|
||||
public void CycleAuraMode()
|
||||
{
|
||||
SetAuraMode(Program.config.getConfig("aura_mode") + 1);
|
||||
}
|
||||
|
||||
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
ComboBox cmb = (ComboBox)sender;
|
||||
SetAuraMode(cmb.SelectedIndex);
|
||||
}
|
||||
|
||||
|
||||
private void CheckBoost_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
NativeMethods.SetCPUBoost(3);
|
||||
@@ -94,8 +214,16 @@ namespace GHelper
|
||||
if (frequency > 0)
|
||||
NativeMethods.SetRefreshRate(frequency);
|
||||
|
||||
if (overdrive > 0)
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||
try
|
||||
{
|
||||
if (overdrive > 0)
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Screen Overdrive not supported");
|
||||
}
|
||||
|
||||
|
||||
InitScreen();
|
||||
}
|
||||
@@ -117,7 +245,7 @@ namespace GHelper
|
||||
{
|
||||
button60Hz.Enabled = false;
|
||||
button120Hz.Enabled = false;
|
||||
labelSreen.Text = "Latop Screen: Turned off";
|
||||
labelSreen.Text = "Laptop Screen: Turned off";
|
||||
button60Hz.BackColor = SystemColors.ControlLight;
|
||||
button120Hz.BackColor = SystemColors.ControlLight;
|
||||
}
|
||||
@@ -127,10 +255,18 @@ namespace GHelper
|
||||
button120Hz.Enabled = true;
|
||||
button60Hz.BackColor = SystemColors.ControlLightLight;
|
||||
button120Hz.BackColor = SystemColors.ControlLightLight;
|
||||
labelSreen.Text = "Latop Screen";
|
||||
labelSreen.Text = "Laptop Screen";
|
||||
}
|
||||
|
||||
int overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
||||
int overdrive = 0;
|
||||
try
|
||||
{
|
||||
overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Screen Overdrive not supported");
|
||||
}
|
||||
|
||||
button60Hz.FlatAppearance.BorderSize = buttonInactive;
|
||||
button120Hz.FlatAppearance.BorderSize = buttonInactive;
|
||||
@@ -190,22 +326,54 @@ namespace GHelper
|
||||
|
||||
private static void SetTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(1000);
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
aTimer.AutoReset = true;
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private static void OnTimedEvent(Object source, ElapsedEventArgs e)
|
||||
private static void RefreshSensors()
|
||||
{
|
||||
var cpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6);
|
||||
var gpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6);
|
||||
string cpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6).ToString() + "%";
|
||||
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6) + "%";
|
||||
|
||||
string cpuTemp = "";
|
||||
string gpuTemp = "";
|
||||
string battery = "";
|
||||
|
||||
try
|
||||
{
|
||||
Program.hwmonitor.ReadSensors();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Failed reading sensors");
|
||||
}
|
||||
|
||||
if (Program.hwmonitor.cpuTemp > 0)
|
||||
cpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.cpuTemp).ToString() + "°C - ";
|
||||
|
||||
if (Program.hwmonitor.gpuTemp > 0)
|
||||
gpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.gpuTemp).ToString() + "°C - ";
|
||||
|
||||
if (Program.hwmonitor.batteryDischarge > 0)
|
||||
battery = "Discharging: " + Math.Round((decimal)Program.hwmonitor.batteryDischarge, 1).ToString() + "W";
|
||||
|
||||
if (Program.hwmonitor.batteryCharge > 0)
|
||||
battery = "Charging: " + Math.Round((decimal)Program.hwmonitor.batteryCharge, 1).ToString() + "W";
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
Program.settingsForm.labelCPUFan.Text = "CPU Fan: " + cpuFan.ToString() + "%";
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU Fan: " + gpuFan.ToString() + "%";
|
||||
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
||||
Program.settingsForm.labelBattery.Text = battery;
|
||||
});
|
||||
}
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
RefreshSensors();
|
||||
aTimer.Interval = 2000;
|
||||
}
|
||||
|
||||
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
|
||||
@@ -217,15 +385,19 @@ namespace GHelper
|
||||
this.Left = Screen.FromControl(this).Bounds.Width - 10 - this.Width;
|
||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||
this.Activate();
|
||||
|
||||
aTimer.Interval = 500;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
aTimer.Enabled = false;
|
||||
Program.hwmonitor.StopReading();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced)
|
||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||
{
|
||||
|
||||
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
||||
@@ -236,29 +408,39 @@ namespace GHelper
|
||||
{
|
||||
case ASUSWmi.PerformanceSilent:
|
||||
buttonSilent.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Silent";
|
||||
perfName = "Silent";
|
||||
break;
|
||||
case ASUSWmi.PerformanceTurbo:
|
||||
buttonTurbo.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Turbo";
|
||||
perfName = "Turbo";
|
||||
break;
|
||||
default:
|
||||
buttonBalanced.FlatAppearance.BorderSize = buttonActive;
|
||||
labelPerf.Text = "Peformance Mode: Balanced";
|
||||
PerformanceMode = ASUSWmi.PerformanceBalanced;
|
||||
perfName = "Balanced";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||
try
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
labelPerf.Text = "Performance Mode: not supported";
|
||||
}
|
||||
|
||||
if (fans != null && fans.Text != "")
|
||||
fans.LoadFans();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void CyclePerformanceMode()
|
||||
{
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1);
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
||||
}
|
||||
|
||||
public void AutoScreen(int Plugged = 1)
|
||||
@@ -271,6 +453,8 @@ namespace GHelper
|
||||
else
|
||||
SetScreen(60, 0);
|
||||
|
||||
InitScreen();
|
||||
|
||||
}
|
||||
|
||||
public void AutoGPUMode(int Plugged = 1)
|
||||
@@ -282,7 +466,6 @@ namespace GHelper
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
int GPUMode;
|
||||
|
||||
if (mux == 0) // GPU in Ultimate, ignore
|
||||
return;
|
||||
@@ -291,18 +474,12 @@ namespace GHelper
|
||||
if (eco == 1 && Plugged == 1) // Eco going Standard on plugged
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
||||
|
||||
GPUMode = ASUSWmi.GPUModeStandard;
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.config.setConfig("gpu_mode", GPUMode);
|
||||
InitGPUMode();
|
||||
}
|
||||
else if (eco == 0 && Plugged == 0) // Standard going Eco on plugged
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
||||
|
||||
GPUMode = ASUSWmi.GPUModeEco;
|
||||
VisualiseGPUMode(GPUMode);
|
||||
Program.config.setConfig("gpu_mode", GPUMode);
|
||||
InitGPUMode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -466,11 +643,11 @@ namespace GHelper
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
{
|
||||
Program.scheduler.Schedule();
|
||||
Startup.Schedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.scheduler.UnSchedule();
|
||||
Startup.UnSchedule();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,21 +656,34 @@ namespace GHelper
|
||||
|
||||
if (limit < 50 || limit > 100) limit = 100;
|
||||
|
||||
labelBatteryLimit.Text = limit.ToString() + "%";
|
||||
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
||||
trackBattery.Value = limit;
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||
try
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Can't set battery charge limit");
|
||||
}
|
||||
Program.config.setConfig("charge_limit", limit);
|
||||
|
||||
}
|
||||
|
||||
private void trackBatteryChange(object sender, EventArgs e)
|
||||
private void trackBatteryChange(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
TrackBar bar = (TrackBar)sender;
|
||||
SetBatteryChargeLimit(bar.Value);
|
||||
}
|
||||
|
||||
private void checkGPU_CheckedChanged(object sender, EventArgs e)
|
||||
private void checkGPU_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
Program.config.setConfig("gpu_auto", 1);
|
||||
@@ -502,8 +692,12 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
private void checkScreen_CheckedChanged(object sender, EventArgs e)
|
||||
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (sender is null)
|
||||
return;
|
||||
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
if (chk.Checked)
|
||||
Program.config.setConfig("screen_auto", 1);
|
||||
@@ -511,6 +705,7 @@ namespace GHelper
|
||||
Program.config.setConfig("screen_auto", 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,4 +57,62 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="pictureBattery.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||
DAAACwwBP0AiyAAAAY1JREFUaEPtlz1OAzEQhVdIFFyCH0EFDQ1wAhDcgxPACYCOA/BzGTo6aKGKFOAE
|
||||
0FCABO9FsbSK3uI8J9kFMZ/0FdmMZ+xovLGrIAiCIAiCQLIMr+EL/IRfM5Y1WOsKsvZE7ME3qAq1IWvv
|
||||
wiJWYJeTT77CJWjDtlEJu/AS2rAPVbIufII2bWzYceVcbFQix1V4CKe1j2xUEscEN+ANVDGONiqJY505
|
||||
eATfoYp15N48gFnUYEfFOryDKt7xGWZRA0flhHbgOewNnyWbmIcn8APW412zqEGj8u9+ASY24Rl8GHz6
|
||||
mS34CFXeccyiBik5iW2Yg4vi4rjIBBfPH0HlzZlFDWqS7XAK2R5N1OPZbmw7tt/G8JlrFjUo5z3khBQq
|
||||
vtSpbWIlX5XHkK/OOiq2RE5+H2ZRgx1v4RpMqBhHG5XElccIHie4EPW9o82fP8yx11SyLuxDm9L38yy8
|
||||
gDa8UP+WK+UiLIIXaiZQiduQtYsv9Qme53kn5bWujY3NGqzFtin+5YMgCIIgCP4PVfUNWXMTLz5Z0sYA
|
||||
AAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||
DAAACwwBP0AiyAAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
|
||||
EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k
|
||||
vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k
|
||||
d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar
|
||||
gyEuVOpPM/cTG9LVwRAXKnXqDOxKVwdDXAhLViHW+SmcSFcHQ1wIS1YhNqmx8Jn7JF0dDHEhLFmFkPV9
|
||||
DOfS5ZMhLlRDdthoEHT+13biWrJJsc7zojJzXHnmhx6b3BAXaskQF2rF2X8PzP6LbE+GuOAq5V8J7vyo
|
||||
zkMeniX/ZgB5u5oWM7ZY3q6mxYwtxsuVt61hlTOJdFbAdQjOFWoOglrXshg6xqnNLI6YOp1OZ1UsFt/W
|
||||
cWCm8IATjAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||
DAAACwwBP0AiyAAAA31JREFUaEPt2NnrTkEcx/HHmj37hTWJP0BCSe5ESSnklivJUsiuXFiSIlsS98qW
|
||||
CLmTP0FKUkqkrNn37f2p39T07fucmfM85/eQzqdexW/mzJlzzpyZeU6jTp06df6L9MQsbMdF3MVrfOui
|
||||
f+tvF7ANM6Fj/nrGYT+e4HdJj7EPY9HxjMBJfIXXuTK+4ASGoyNZjpfwOtOOF1iGbktv6K57J6/Scehc
|
||||
laY/rsI7YfADt7EReqFHow8GYCJmYzNu4ju8NoIr0Dkrie5GUec/4QDU4dzMh9dWTBdRyZMoGjbnMR5l
|
||||
oxfWa886hraiF9Zr+Cc05/dAHF3MGtzAPXzARzzCNWzAAmit8Nr1LEFL0VTpzTbqvC4sjuby09B7YOsX
|
||||
UVvrMBA7u/5mPccwlE6zoaM7H2cR3sGrW0SdX4mQIfDqSemhpBXWW6Q05uNhsxbqiK2XYjuvrIdXV7TY
|
||||
jUF2tD2wjWi2iV9Y3fmqOq//p9rai6z0gre30VQZojFfxbBRcjovmgiyNoBahOzBejnjef4MbJ2UnM6f
|
||||
w1BonfAWuxlIRi+pPVArbIiGUSuzTc6dn4cQrdhxmWxBMpdgD9T8HaIX15YX+YVViNNs2MTn2Qpbrkkk
|
||||
Gf3wsAdqWIVchy23NINp36OZYxDiNOu8aMsSor2TLb+DZF7BHjgKIfdhy61mj7qo8/IQIZNgy7XlTsab
|
||||
//siJGf28ebswSjqvGjrEaLV2ZZrPUhGleyB8TB4D1tueRegqderG9PNCdEF2/KsC9Dewx44BSEPYMst
|
||||
bwh5L6Wl4RkyFbb8GZLxXuI5CNFO05ZbGoa6CD0J0b9zfj9rxxoyF7Y86yXWYmIP3ISQstNoGasRoou2
|
||||
5WeRzA7YA28hZAJSPwlboTbjvZYWT1tH35SSmQ57oBofiRDt/W2ddp1CiLYt3mo/Dclow/QU9uB4M6ft
|
||||
9lvYOq16g/gD10HYOvoQZn8BNs0e2AY+I37E2nCV3RN5tDYsRIguRFt3W283sqOO6pumbUTfNuO7oEZt
|
||||
nbLijqltby+mGSx+Qlk5AtuQ6LdryGR4dcrQliFkF7w6h1E6emm9fZEe+QpopVTDtrysQ1BbzfZJ2v+0
|
||||
/N10MWyDnbYUbUVfjr2GO+Eo2o5+I5f5EFWVyj4tKvrQehneibqDZqJ+qDR6EnrhcjZlrVLbOofOVadO
|
||||
nTr/fBqNP4sju3bXhjy/AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||
DAAACwwBP0AiyAAAANBJREFUaEPt2DESAUEUhOF1PQQuxd1wHAGi1U8galU9ktej+qv6M71myyZriYiI
|
||||
+Fd7dEFPtDZV311n2KEhdXh2wc4OSHZF7CKdnZGs87H51gPJ2AUckrGxQzI2dkjGxg7J2NghGRs7JGNj
|
||||
h2Rs7JCMjR2SsbFDMjZ2SMbGDsnY2CEZGzskY2OHZGzskIyNHZKxsUOy6V8pp3+pr/9h2EU626IhdRN1
|
||||
191/bNUZhg8fMeiE7og9h47VWY/obYNuiH3QuTrzR93NtL9ARET8aFleMDJURjd/4/oAAAAASUVORK5C
|
||||
YII=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
53
Startup.cs
Normal file
53
Startup.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Principal;
|
||||
|
||||
public class Startup
|
||||
{
|
||||
|
||||
static string taskName = "GHelper";
|
||||
|
||||
public static bool IsScheduled()
|
||||
{
|
||||
TaskService taskService = new TaskService();
|
||||
|
||||
// cleanup of OLD autorun
|
||||
try
|
||||
{
|
||||
taskService.RootFolder.DeleteTask("GSharpHelper");
|
||||
} catch
|
||||
{
|
||||
Debug.WriteLine("Not running as admin");
|
||||
}
|
||||
|
||||
|
||||
return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName));
|
||||
}
|
||||
|
||||
public static void Schedule()
|
||||
{
|
||||
|
||||
string strExeFilePath = Application.ExecutablePath;
|
||||
|
||||
if (strExeFilePath is null) return;
|
||||
|
||||
var userId = WindowsIdentity.GetCurrent().Name;
|
||||
|
||||
//Debug.WriteLine(strExeFilePath);
|
||||
TaskDefinition td = TaskService.Instance.NewTask();
|
||||
td.RegistrationInfo.Description = "GHelper Auto Start";
|
||||
td.Triggers.Add(new LogonTrigger { UserId = userId, });
|
||||
td.Actions.Add(strExeFilePath);
|
||||
|
||||
td.Settings.StopIfGoingOnBatteries = false;
|
||||
td.Settings.DisallowStartIfOnBatteries = false;
|
||||
|
||||
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
||||
}
|
||||
|
||||
public static void UnSchedule()
|
||||
{
|
||||
TaskService taskService = new TaskService();
|
||||
taskService.RootFolder.DeleteTask(taskName);
|
||||
}
|
||||
}
|
||||
85
ToastForm.Designer.cs
generated
Normal file
85
ToastForm.Designer.cs
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
namespace GHelper
|
||||
{
|
||||
partial class ToastForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureIcon = new System.Windows.Forms.PictureBox();
|
||||
this.labelMode = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureIcon
|
||||
//
|
||||
this.pictureIcon.BackgroundImage = global::GHelper.Properties.Resources.icons8_speed_96;
|
||||
this.pictureIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureIcon.Location = new System.Drawing.Point(21, 21);
|
||||
this.pictureIcon.Name = "pictureIcon";
|
||||
this.pictureIcon.Size = new System.Drawing.Size(82, 80);
|
||||
this.pictureIcon.TabIndex = 0;
|
||||
this.pictureIcon.TabStop = false;
|
||||
//
|
||||
// labelMode
|
||||
//
|
||||
this.labelMode.AutoSize = true;
|
||||
this.labelMode.Font = new System.Drawing.Font("Segoe UI", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.labelMode.Location = new System.Drawing.Point(127, 32);
|
||||
this.labelMode.Name = "labelMode";
|
||||
this.labelMode.Size = new System.Drawing.Size(195, 59);
|
||||
this.labelMode.TabIndex = 1;
|
||||
this.labelMode.Text = "Balanced";
|
||||
this.labelMode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// ToastForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.ClientSize = new System.Drawing.Size(356, 122);
|
||||
this.Controls.Add(this.labelMode);
|
||||
this.Controls.Add(this.pictureIcon);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MdiChildrenMinimizedAnchorBottom = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ToastForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "ToastForm";
|
||||
this.TopMost = true;
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureIcon;
|
||||
private Label labelMode;
|
||||
}
|
||||
}
|
||||
68
ToastForm.cs
Normal file
68
ToastForm.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class ToastForm : Form
|
||||
{
|
||||
|
||||
private System.Windows.Forms.Timer timer = default!;
|
||||
|
||||
private const int SW_SHOWNOACTIVATE = 4;
|
||||
private const int HWND_TOPMOST = -1;
|
||||
private const uint SWP_NOACTIVATE = 0x0010;
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
|
||||
static extern bool SetWindowPos(
|
||||
int hWnd, // Window handle
|
||||
int hWndInsertAfter, // Placement-order handle
|
||||
int X, // Horizontal position
|
||||
int Y, // Vertical position
|
||||
int cx, // Width
|
||||
int cy, // Height
|
||||
uint uFlags); // Window positioning flags
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
static void ShowInactiveTopmost(Form frm)
|
||||
{
|
||||
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
|
||||
SetWindowPos(frm.Handle.ToInt32(), HWND_TOPMOST,
|
||||
frm.Left, frm.Top, frm.Width, frm.Height,
|
||||
SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
public ToastForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void RunToast(string text)
|
||||
{
|
||||
|
||||
Top = Screen.FromControl(this).WorkingArea.Height - this.Height - 100;
|
||||
Left = (Screen.FromControl(this).Bounds.Width - this.Width) / 2;
|
||||
|
||||
ShowInactiveTopmost(this);
|
||||
|
||||
labelMode.Text = text;
|
||||
|
||||
timer = new System.Windows.Forms.Timer();
|
||||
timer.Tick += new EventHandler(timer_Tick);
|
||||
timer.Enabled = true;
|
||||
timer.Interval = 1000;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void ToastForm_Show(object? sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
timer.Stop();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
ToastForm.resx
Normal file
60
ToastForm.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
17
app.manifest
17
app.manifest
@@ -16,7 +16,7 @@
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
@@ -53,13 +53,16 @@
|
||||
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<windowsSettings>
|
||||
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
|
||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 813 KiB After Width: | Height: | Size: 2.3 MiB |
Reference in New Issue
Block a user