mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
13 Commits
notificati
...
v0.9.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d02703cf1c | ||
|
|
4630fee687 | ||
|
|
e5890648b9 | ||
|
|
c292226fa2 | ||
|
|
1c17c705de | ||
|
|
27f5ed50d5 | ||
|
|
02ae48092b | ||
|
|
41d92d76cc | ||
|
|
44c3d9f3c7 | ||
|
|
146150b1e7 | ||
|
|
ccf4ae5126 | ||
|
|
249fef0bb1 | ||
|
|
2ee9110016 |
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
109
Fans.Designer.cs
generated
Normal file
109
Fans.Designer.cs
generated
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
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.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
|
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);
|
||||||
|
chartCPU.Location = new Point(16, 13);
|
||||||
|
chartCPU.Name = "chartCPU";
|
||||||
|
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);
|
||||||
|
chartGPU.Location = new Point(16, 477);
|
||||||
|
chartGPU.Name = "chartGPU";
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
214
Fans.cs
Normal file
214
Fans.cs
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
if (chart.Legends.Count > 0)
|
||||||
|
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, 1);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net7.0-windows10.0.17763.0</TargetFramework>
|
<TargetFramework>net7.0-windows8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||||
|
<AssemblyName>GHelper</AssemblyName>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -33,10 +35,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
||||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
|
||||||
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.1" />
|
|
||||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||||
|
<PackageReference Include="WinForms.DataVisualization" Version="1.7.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -50,22 +51,22 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Resources\eco.ico">
|
<Content Include="Resources\eco.ico">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\icons8-charging-battery-48.png">
|
<Content Include="Resources\icons8-charging-battery-48.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\icons8-laptop-48.png">
|
<Content Include="Resources\icons8-laptop-48.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\icons8-speed-48.png">
|
<Content Include="Resources\icons8-speed-48.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\icons8-video-card-48.png">
|
<Content Include="Resources\icons8-video-card-48.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\ultimate.ico">
|
<Content Include="Resources\ultimate.ico">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
482
OSDBase.cs
Normal file
482
OSDBase.cs
Normal file
@@ -0,0 +1,482 @@
|
|||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace OSD
|
||||||
|
{
|
||||||
|
|
||||||
|
class OSDNativeForm : NativeWindow, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private bool _disposed = false;
|
||||||
|
private byte _alpha = 250;
|
||||||
|
private Size _size = new Size(350, 50);
|
||||||
|
private Point _location = new Point(50, 50);
|
||||||
|
|
||||||
|
|
||||||
|
protected virtual void PerformPaint(PaintEventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected internal void Invalidate()
|
||||||
|
{
|
||||||
|
this.UpdateLayeredWindow();
|
||||||
|
}
|
||||||
|
private void UpdateLayeredWindow()
|
||||||
|
{
|
||||||
|
Bitmap bitmap1 = new Bitmap(this.Size.Width, this.Size.Height, PixelFormat.Format32bppArgb);
|
||||||
|
using (Graphics graphics1 = Graphics.FromImage(bitmap1))
|
||||||
|
{
|
||||||
|
Rectangle rectangle1;
|
||||||
|
SIZE size1;
|
||||||
|
POINT point1;
|
||||||
|
POINT point2;
|
||||||
|
BLENDFUNCTION blendfunction1;
|
||||||
|
rectangle1 = new Rectangle(0, 0, this.Size.Width, this.Size.Height);
|
||||||
|
PerformPaint(new PaintEventArgs(graphics1, rectangle1));
|
||||||
|
IntPtr ptr1 = User32.GetDC(IntPtr.Zero);
|
||||||
|
IntPtr ptr2 = Gdi32.CreateCompatibleDC(ptr1);
|
||||||
|
IntPtr ptr3 = bitmap1.GetHbitmap(Color.FromArgb(0));
|
||||||
|
IntPtr ptr4 = Gdi32.SelectObject(ptr2, ptr3);
|
||||||
|
size1.cx = this.Size.Width;
|
||||||
|
size1.cy = this.Size.Height;
|
||||||
|
point1.x = this.Location.X;
|
||||||
|
point1.x = this.Location.X;
|
||||||
|
point1.y = this.Location.Y;
|
||||||
|
point2.x = 0;
|
||||||
|
point2.y = 0;
|
||||||
|
blendfunction1 = new BLENDFUNCTION();
|
||||||
|
blendfunction1.BlendOp = 0;
|
||||||
|
blendfunction1.BlendFlags = 0;
|
||||||
|
blendfunction1.SourceConstantAlpha = this._alpha;
|
||||||
|
blendfunction1.AlphaFormat = 1;
|
||||||
|
User32.UpdateLayeredWindow(base.Handle, ptr1, ref point1, ref size1, ptr2, ref point2, 0, ref blendfunction1, 2); //2=ULW_ALPHA
|
||||||
|
Gdi32.SelectObject(ptr2, ptr4);
|
||||||
|
User32.ReleaseDC(IntPtr.Zero, ptr1);
|
||||||
|
Gdi32.DeleteObject(ptr3);
|
||||||
|
Gdi32.DeleteDC(ptr2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Show()
|
||||||
|
{
|
||||||
|
if (base.Handle == IntPtr.Zero) //if handle don't equal to zero - window was created and just hided
|
||||||
|
this.CreateWindowOnly();
|
||||||
|
User32.ShowWindow(base.Handle, User32.SW_SHOWNOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public virtual void Hide()
|
||||||
|
{
|
||||||
|
if (base.Handle == IntPtr.Zero)
|
||||||
|
return;
|
||||||
|
User32.ShowWindow(base.Handle, User32.SW_HIDE);
|
||||||
|
this.DestroyHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public virtual void Close()
|
||||||
|
{
|
||||||
|
this.Hide();
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateWindowOnly()
|
||||||
|
{
|
||||||
|
|
||||||
|
CreateParams params1 = new CreateParams();
|
||||||
|
params1.Caption = "FloatingNativeWindow";
|
||||||
|
int nX = this._location.X;
|
||||||
|
int nY = this._location.Y;
|
||||||
|
Screen screen1 = Screen.FromHandle(base.Handle);
|
||||||
|
if ((nX + this._size.Width) > screen1.Bounds.Width)
|
||||||
|
{
|
||||||
|
nX = screen1.Bounds.Width - this._size.Width;
|
||||||
|
}
|
||||||
|
if ((nY + this._size.Height) > screen1.Bounds.Height)
|
||||||
|
{
|
||||||
|
nY = screen1.Bounds.Height - this._size.Height;
|
||||||
|
}
|
||||||
|
this._location = new Point(nX, nY);
|
||||||
|
Size size1 = this._size;
|
||||||
|
Point point1 = this._location;
|
||||||
|
params1.X = nX;
|
||||||
|
params1.Y = nY;
|
||||||
|
params1.Height = size1.Height;
|
||||||
|
params1.Width = size1.Width;
|
||||||
|
params1.Parent = IntPtr.Zero;
|
||||||
|
uint ui = User32.WS_POPUP;
|
||||||
|
params1.Style = (int)ui;
|
||||||
|
params1.ExStyle = User32.WS_EX_TOPMOST | User32.WS_EX_TOOLWINDOW | User32.WS_EX_LAYERED | User32.WS_EX_NOACTIVATE | User32.WS_EX_TRANSPARENT;
|
||||||
|
this.CreateHandle(params1);
|
||||||
|
this.UpdateLayeredWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected virtual void SetBoundsCore(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
if (((this.X != x) || (this.Y != y)) || ((this.Width != width) || (this.Height != height)))
|
||||||
|
{
|
||||||
|
if (base.Handle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
int num1 = 20;
|
||||||
|
if ((this.X == x) && (this.Y == y))
|
||||||
|
{
|
||||||
|
num1 |= 2;
|
||||||
|
}
|
||||||
|
if ((this.Width == width) && (this.Height == height))
|
||||||
|
{
|
||||||
|
num1 |= 1;
|
||||||
|
}
|
||||||
|
User32.SetWindowPos(base.Handle, IntPtr.Zero, x, y, width, height, (uint)num1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Location = new Point(x, y);
|
||||||
|
this.Size = new Size(width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region # Properties #
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set position of top-left corner of floating native window in screen coordinates
|
||||||
|
/// </summary>
|
||||||
|
public virtual Point Location
|
||||||
|
{
|
||||||
|
get { return this._location; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.Handle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
this.SetBoundsCore(value.X, value.Y, this._size.Width, this._size.Height);
|
||||||
|
RECT rect = new RECT();
|
||||||
|
User32.GetWindowRect(base.Handle, ref rect);
|
||||||
|
this._location = new Point(rect.left, rect.top);
|
||||||
|
this.UpdateLayeredWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._location = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set size of client area of floating native window
|
||||||
|
/// </summary>
|
||||||
|
public virtual Size Size
|
||||||
|
{
|
||||||
|
get { return this._size; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.Handle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
this.SetBoundsCore(this._location.X, this._location.Y, value.Width, value.Height);
|
||||||
|
RECT rect = new RECT();
|
||||||
|
User32.GetWindowRect(base.Handle, ref rect);
|
||||||
|
this._size = new Size(rect.right - rect.left, rect.bottom - rect.top);
|
||||||
|
this.UpdateLayeredWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._size = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the height of the floating native window
|
||||||
|
/// </summary>
|
||||||
|
public int Height
|
||||||
|
{
|
||||||
|
get { return this._size.Height; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._size = new Size(this._size.Width, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the width of the floating native window
|
||||||
|
/// </summary>
|
||||||
|
public int Width
|
||||||
|
{
|
||||||
|
get { return this._size.Width; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._size = new Size(value, this._size.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set x-coordinate of top-left corner of floating native window in screen coordinates
|
||||||
|
/// </summary>
|
||||||
|
public int X
|
||||||
|
{
|
||||||
|
get { return this._location.X; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.Location = new Point(value, this.Location.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set y-coordinate of top-left corner of floating native window in screen coordinates
|
||||||
|
/// </summary>
|
||||||
|
public int Y
|
||||||
|
{
|
||||||
|
get { return this._location.Y; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.Location = new Point(this.Location.X, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get rectangle represented client area of floating native window in client coordinates(top-left corner always has coord. 0,0)
|
||||||
|
/// </summary>
|
||||||
|
public Rectangle Bound
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Rectangle(new Point(0, 0), this._size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set full opacity(255) or full transparency(0) or any intermediate state for floating native window transparency
|
||||||
|
/// </summary>
|
||||||
|
public byte Alpha
|
||||||
|
{
|
||||||
|
get { return this._alpha; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (this._alpha == value) return;
|
||||||
|
this._alpha = value;
|
||||||
|
this.UpdateLayeredWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDisposable Members
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
private void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!this._disposed)
|
||||||
|
{
|
||||||
|
this.DestroyHandle();
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
#region # Win32 #
|
||||||
|
internal struct PAINTSTRUCT
|
||||||
|
{
|
||||||
|
public IntPtr hdc;
|
||||||
|
public int fErase;
|
||||||
|
public Rectangle rcPaint;
|
||||||
|
public int fRestore;
|
||||||
|
public int fIncUpdate;
|
||||||
|
public int Reserved1;
|
||||||
|
public int Reserved2;
|
||||||
|
public int Reserved3;
|
||||||
|
public int Reserved4;
|
||||||
|
public int Reserved5;
|
||||||
|
public int Reserved6;
|
||||||
|
public int Reserved7;
|
||||||
|
public int Reserved8;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct POINT
|
||||||
|
{
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct RECT
|
||||||
|
{
|
||||||
|
public int left;
|
||||||
|
public int top;
|
||||||
|
public int right;
|
||||||
|
public int bottom;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct SIZE
|
||||||
|
{
|
||||||
|
public int cx;
|
||||||
|
public int cy;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct TRACKMOUSEEVENTS
|
||||||
|
{
|
||||||
|
public uint cbSize;
|
||||||
|
public uint dwFlags;
|
||||||
|
public IntPtr hWnd;
|
||||||
|
public uint dwHoverTime;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct MSG
|
||||||
|
{
|
||||||
|
public IntPtr hwnd;
|
||||||
|
public int message;
|
||||||
|
public IntPtr wParam;
|
||||||
|
public IntPtr lParam;
|
||||||
|
public int time;
|
||||||
|
public int pt_x;
|
||||||
|
public int pt_y;
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct BLENDFUNCTION
|
||||||
|
{
|
||||||
|
public byte BlendOp;
|
||||||
|
public byte BlendFlags;
|
||||||
|
public byte SourceConstantAlpha;
|
||||||
|
public byte AlphaFormat;
|
||||||
|
}
|
||||||
|
internal class User32
|
||||||
|
{
|
||||||
|
public const uint WS_POPUP = 0x80000000;
|
||||||
|
public const int WS_EX_TOPMOST = 0x8;
|
||||||
|
public const int WS_EX_TOOLWINDOW = 0x80;
|
||||||
|
public const int WS_EX_LAYERED = 0x80000;
|
||||||
|
public const int WS_EX_TRANSPARENT = 0x20;
|
||||||
|
public const int WS_EX_NOACTIVATE = 0x08000000;
|
||||||
|
public const int SW_SHOWNOACTIVATE = 4;
|
||||||
|
public const int SW_HIDE = 0;
|
||||||
|
public const uint AW_HOR_POSITIVE = 0x1;
|
||||||
|
public const uint AW_HOR_NEGATIVE = 0x2;
|
||||||
|
public const uint AW_VER_POSITIVE = 0x4;
|
||||||
|
public const uint AW_VER_NEGATIVE = 0x8;
|
||||||
|
public const uint AW_CENTER = 0x10;
|
||||||
|
public const uint AW_HIDE = 0x10000;
|
||||||
|
public const uint AW_ACTIVATE = 0x20000;
|
||||||
|
public const uint AW_SLIDE = 0x40000;
|
||||||
|
public const uint AW_BLEND = 0x80000;
|
||||||
|
// Methods
|
||||||
|
private User32()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool AnimateWindow(IntPtr hWnd, uint dwTime, uint dwFlags);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool DispatchMessage(ref MSG msg);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool DrawFocusRect(IntPtr hWnd, ref RECT rect);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr GetFocus();
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern ushort GetKeyState(int virtKey);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool GetMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr GetParent(IntPtr hWnd);
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||||
|
public static extern bool GetClientRect(IntPtr hWnd, [In, Out] ref RECT rect);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr GetWindow(IntPtr hWnd, int cmd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool HideCaret(IntPtr hWnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool InvalidateRect(IntPtr hWnd, ref RECT rect, bool erase);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr LoadCursor(IntPtr hInstance, uint cursor);
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||||
|
public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref RECT rect, int cPoints);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax, uint wFlag);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool ReleaseCapture();
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool ScreenToClient(IntPtr hWnd, ref POINT pt);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern uint SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr SetCursor(IntPtr hCursor);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr SetFocus(IntPtr hWnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int newLong);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, int X, int Y, int Width, int Height, uint flags);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool ShowCaret(IntPtr hWnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool SetCapture(IntPtr hWnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int ShowWindow(IntPtr hWnd, short cmdShow);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int bRetValue, uint fWinINI);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool TranslateMessage(ref MSG msg);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINT pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pprSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool UpdateWindow(IntPtr hwnd);
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool WaitMessage();
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||||
|
public static extern bool AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class Gdi32
|
||||||
|
{
|
||||||
|
// Methods
|
||||||
|
private Gdi32()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int CombineRgn(IntPtr dest, IntPtr src1, IntPtr src2, int flags);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr CreateBrushIndirect(ref LOGBRUSH brush);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr CreateCompatibleDC(IntPtr hDC);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr CreateRectRgnIndirect(ref RECT rect);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool DeleteDC(IntPtr hDC);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr DeleteObject(IntPtr hObject);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int GetClipBox(IntPtr hDC, ref RECT rectBox);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern bool PatBlt(IntPtr hDC, int x, int y, int width, int height, uint flags);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern int SelectClipRgn(IntPtr hDC, IntPtr hRgn);
|
||||||
|
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
|
||||||
|
internal static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
|
||||||
|
}
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct LOGBRUSH
|
||||||
|
{
|
||||||
|
public uint lbStyle;
|
||||||
|
public uint lbColor;
|
||||||
|
public uint lbHatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
606
Program.cs
606
Program.cs
@@ -1,156 +1,10 @@
|
|||||||
using HidLibrary;
|
using Microsoft.Win32;
|
||||||
using LibreHardwareMonitor.Hardware;
|
|
||||||
using Microsoft.Win32.TaskScheduler;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Principal;
|
||||||
using System.Text.Json;
|
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
|
public class AppConfig
|
||||||
{
|
{
|
||||||
@@ -203,449 +57,85 @@ public class AppConfig
|
|||||||
else return -1;
|
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)
|
public void setConfig(string name, int value)
|
||||||
{
|
{
|
||||||
config[name] = 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);
|
File.WriteAllText(configFile, jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class NativeMethods
|
|
||||||
{
|
|
||||||
|
|
||||||
[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);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class UpdateVisitor : IVisitor
|
|
||||||
{
|
|
||||||
public void VisitComputer(IComputer computer)
|
|
||||||
{
|
|
||||||
computer.Traverse(this);
|
|
||||||
}
|
|
||||||
public void VisitHardware(IHardware hardware)
|
|
||||||
{
|
|
||||||
hardware.Update();
|
|
||||||
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
|
|
||||||
}
|
|
||||||
public void VisitSensor(ISensor sensor) { }
|
|
||||||
public void VisitParameter(IParameter parameter) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class HardwareMonitor
|
public class HardwareMonitor
|
||||||
{
|
{
|
||||||
|
|
||||||
Computer computer;
|
public static float? cpuTemp = -1;
|
||||||
|
public static float? batteryDischarge = -1;
|
||||||
|
|
||||||
public float? cpuTemp = -1;
|
|
||||||
public float? gpuTemp = -1;
|
|
||||||
public float? batteryDischarge = -1;
|
|
||||||
public float? batteryCharge = -1;
|
|
||||||
|
|
||||||
public HardwareMonitor()
|
public static void ReadSensors()
|
||||||
{
|
{
|
||||||
computer = new Computer
|
|
||||||
{
|
|
||||||
IsCpuEnabled = true,
|
|
||||||
IsGpuEnabled = true,
|
|
||||||
IsBatteryEnabled = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReadSensors()
|
|
||||||
{
|
|
||||||
|
|
||||||
computer.Open();
|
|
||||||
computer.Accept(new UpdateVisitor());
|
|
||||||
|
|
||||||
cpuTemp = -1;
|
cpuTemp = -1;
|
||||||
gpuTemp = -1;
|
|
||||||
batteryDischarge = -1;
|
batteryDischarge = -1;
|
||||||
batteryCharge = -1;
|
|
||||||
|
|
||||||
foreach (IHardware hardware in computer.Hardware)
|
try
|
||||||
{
|
{
|
||||||
//Debug.WriteLine("Hardware: {0}", hardware.Name);
|
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||||
//Debug.WriteLine("Hardware: {0}", hardware.HardwareType);
|
cpuTemp = ct.NextValue() - 273;
|
||||||
|
ct.Dispose();
|
||||||
|
|
||||||
foreach (ISensor sensor in hardware.Sensors)
|
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
||||||
{
|
batteryDischarge = ct.NextValue() / 1000;
|
||||||
if (sensor.SensorType == SensorType.Temperature)
|
cb.Dispose();
|
||||||
{
|
}
|
||||||
if (hardware.HardwareType.ToString().Contains("Cpu") && sensor.Name.Contains("Core"))
|
catch
|
||||||
{
|
{
|
||||||
cpuTemp = sensor.Value;
|
Debug.WriteLine("Failed reading sensors");
|
||||||
//Debug.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hardware.HardwareType.ToString().Contains("Gpu") && sensor.Name.Contains("Core"))
|
|
||||||
{
|
|
||||||
gpuTemp = sensor.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Debug.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (sensor.SensorType == SensorType.Power)
|
|
||||||
{
|
|
||||||
if (sensor.Name.Contains("Discharge"))
|
|
||||||
{
|
|
||||||
batteryDischarge = sensor.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sensor.Name.Contains("Charge"))
|
|
||||||
{
|
|
||||||
batteryCharge = sensor.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopReading()
|
|
||||||
{
|
|
||||||
computer.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
static class Program
|
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 ASUSWmi wmi = new ASUSWmi();
|
||||||
public static AppConfig config;
|
public static AppConfig config = new AppConfig();
|
||||||
|
|
||||||
public static SettingsForm settingsForm;
|
public static SettingsForm settingsForm = new SettingsForm();
|
||||||
public static ToastForm toastForm;
|
public static ToastForm toast = new ToastForm();
|
||||||
|
|
||||||
public static Startup scheduler;
|
|
||||||
public static HardwareMonitor hwmonitor;
|
|
||||||
|
|
||||||
// The main entry point for the application
|
// The main entry point for the application
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
trayIcon = new NotifyIcon
|
|
||||||
{
|
|
||||||
Text = "G-Helper",
|
|
||||||
Icon = GHelper.Properties.Resources.standard,
|
|
||||||
Visible = true
|
|
||||||
};
|
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||||
|
|
||||||
config = new AppConfig();
|
|
||||||
|
|
||||||
wmi = new ASUSWmi();
|
|
||||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
scheduler = new Startup();
|
|
||||||
|
|
||||||
settingsForm = new SettingsForm();
|
|
||||||
|
|
||||||
settingsForm.InitGPUMode();
|
settingsForm.InitGPUMode();
|
||||||
settingsForm.InitBoost();
|
settingsForm.InitBoost();
|
||||||
settingsForm.InitAura();
|
settingsForm.InitAura();
|
||||||
@@ -656,19 +146,24 @@ namespace GHelper
|
|||||||
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
||||||
settingsForm.VisualiseScreenAuto(config.getConfig("screen_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);
|
bool isPlugged = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
|
||||||
settingsForm.AutoGPUMode(isPlugged ? 1 : 0);
|
settingsForm.AutoGPUMode(isPlugged ? 1 : 0);
|
||||||
settingsForm.AutoScreen(isPlugged ? 1 : 0);
|
settingsForm.AutoScreen(isPlugged ? 1 : 0);
|
||||||
|
|
||||||
hwmonitor = new HardwareMonitor();
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
IntPtr dummy = settingsForm.Handle;
|
|
||||||
|
IntPtr ds = settingsForm.Handle;
|
||||||
|
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
|
}
|
||||||
|
|
||||||
static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
|
static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -705,7 +200,6 @@ namespace GHelper
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case 88: // Plugged
|
case 88: // Plugged
|
||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
|
||||||
settingsForm.BeginInvoke(delegate
|
settingsForm.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
settingsForm.AutoGPUMode(1);
|
settingsForm.AutoGPUMode(1);
|
||||||
|
|||||||
10
Properties/Resources.Designer.cs
generated
10
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_fan_head_96 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-fan-head-96", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -133,6 +133,9 @@
|
|||||||
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</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>
|
||||||
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -142,7 +145,7 @@
|
|||||||
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<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>
|
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-fan-head-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>
|
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
10
README.md
10
README.md
@@ -4,6 +4,8 @@ A tiny system tray utility that allows you set performance and GPU profiles for
|
|||||||
|
|
||||||
Designed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models.
|
Designed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models.
|
||||||
|
|
||||||
|
### [Download latest release](https://github.com/seerge/g14-helper/releases)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Performance Profile switching
|
## Performance Profile switching
|
||||||
@@ -19,6 +21,7 @@ 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
|
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
|
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
|
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display
|
||||||
|
4. **Custom fan profiles** for any mode!
|
||||||
|
|
||||||
## Extras
|
## Extras
|
||||||
|
|
||||||
@@ -33,8 +36,7 @@ Profiles are **same** as in Armory Crate, including default fan curves
|
|||||||
|
|
||||||
## Things still missing
|
## Things still missing
|
||||||
|
|
||||||
1. Custom fan profiles
|
1. Anime matrix control
|
||||||
2. Anime matrix control
|
|
||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
@@ -42,8 +44,8 @@ Profiles are **same** as in Armory Crate, including default fan curves
|
|||||||
2. Unzip to a folder of your choice
|
2. Unzip to a folder of your choice
|
||||||
3. Run **GHelper.exe**
|
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.
|
Note: Uses low level ASUS ACPI commands to do switching and doens't require Armory Crate to be isntalled at all.
|
||||||
Therefore requires Administrator priveledges on Windows to run.
|
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.
|
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-fan-head-96.png
Normal file
BIN
Resources/icons8-fan-head-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
878
Settings.Designer.cs
generated
878
Settings.Designer.cs
generated
@@ -29,546 +29,540 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
||||||
this.checkStartup = new System.Windows.Forms.CheckBox();
|
checkStartup = new CheckBox();
|
||||||
this.trackBattery = new System.Windows.Forms.TrackBar();
|
trackBattery = new TrackBar();
|
||||||
this.labelBatteryTitle = new System.Windows.Forms.Label();
|
labelBatteryTitle = new Label();
|
||||||
this.pictureBattery = new System.Windows.Forms.PictureBox();
|
pictureBattery = new PictureBox();
|
||||||
this.labelGPUFan = new System.Windows.Forms.Label();
|
labelGPUFan = new Label();
|
||||||
this.tableGPU = new System.Windows.Forms.TableLayoutPanel();
|
tableGPU = new TableLayoutPanel();
|
||||||
this.buttonUltimate = new System.Windows.Forms.Button();
|
buttonUltimate = new Button();
|
||||||
this.buttonStandard = new System.Windows.Forms.Button();
|
buttonStandard = new Button();
|
||||||
this.buttonEco = new System.Windows.Forms.Button();
|
buttonEco = new Button();
|
||||||
this.labelGPU = new System.Windows.Forms.Label();
|
labelGPU = new Label();
|
||||||
this.pictureGPU = new System.Windows.Forms.PictureBox();
|
pictureGPU = new PictureBox();
|
||||||
this.labelCPUFan = new System.Windows.Forms.Label();
|
labelCPUFan = new Label();
|
||||||
this.tablePerf = new System.Windows.Forms.TableLayoutPanel();
|
tablePerf = new TableLayoutPanel();
|
||||||
this.buttonTurbo = new System.Windows.Forms.Button();
|
buttonTurbo = new Button();
|
||||||
this.buttonBalanced = new System.Windows.Forms.Button();
|
buttonBalanced = new Button();
|
||||||
this.buttonSilent = new System.Windows.Forms.Button();
|
buttonSilent = new Button();
|
||||||
this.picturePerf = new System.Windows.Forms.PictureBox();
|
picturePerf = new PictureBox();
|
||||||
this.labelPerf = new System.Windows.Forms.Label();
|
labelPerf = new Label();
|
||||||
this.checkGPU = new System.Windows.Forms.CheckBox();
|
checkGPU = new CheckBox();
|
||||||
this.buttonQuit = new System.Windows.Forms.Button();
|
buttonQuit = new Button();
|
||||||
this.pictureScreen = new System.Windows.Forms.PictureBox();
|
pictureScreen = new PictureBox();
|
||||||
this.labelSreen = new System.Windows.Forms.Label();
|
labelSreen = new Label();
|
||||||
this.tableScreen = new System.Windows.Forms.TableLayoutPanel();
|
tableScreen = new TableLayoutPanel();
|
||||||
this.button120Hz = new System.Windows.Forms.Button();
|
button120Hz = new Button();
|
||||||
this.button60Hz = new System.Windows.Forms.Button();
|
button60Hz = new Button();
|
||||||
this.checkScreen = new System.Windows.Forms.CheckBox();
|
checkScreen = new CheckBox();
|
||||||
this.checkBoost = new System.Windows.Forms.CheckBox();
|
checkBoost = new CheckBox();
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
pictureBox1 = new PictureBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
label1 = new Label();
|
||||||
this.comboKeyboard = new System.Windows.Forms.ComboBox();
|
comboKeyboard = new ComboBox();
|
||||||
this.buttonKeyboardColor = new System.Windows.Forms.Button();
|
buttonKeyboardColor = new Button();
|
||||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
labelBattery = new Label();
|
||||||
this.labelBattery = new System.Windows.Forms.Label();
|
buttonFans = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackBattery).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBattery).BeginInit();
|
||||||
this.tableGPU.SuspendLayout();
|
tableGPU.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureGPU)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
||||||
this.tablePerf.SuspendLayout();
|
tablePerf.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picturePerf)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureScreen).BeginInit();
|
||||||
this.tableScreen.SuspendLayout();
|
tableScreen.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
SuspendLayout();
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
//
|
||||||
// checkStartup
|
// checkStartup
|
||||||
//
|
//
|
||||||
this.checkStartup.AutoSize = true;
|
checkStartup.AutoSize = true;
|
||||||
this.checkStartup.Location = new System.Drawing.Point(40, 1007);
|
checkStartup.Location = new Point(40, 1016);
|
||||||
this.checkStartup.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
checkStartup.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.checkStartup.Name = "checkStartup";
|
checkStartup.Name = "checkStartup";
|
||||||
this.checkStartup.Size = new System.Drawing.Size(206, 36);
|
checkStartup.Size = new Size(206, 36);
|
||||||
this.checkStartup.TabIndex = 2;
|
checkStartup.TabIndex = 2;
|
||||||
this.checkStartup.Text = "Run on Startup";
|
checkStartup.Text = "Run on Startup";
|
||||||
this.checkStartup.UseVisualStyleBackColor = true;
|
checkStartup.UseVisualStyleBackColor = true;
|
||||||
this.checkStartup.CheckedChanged += new System.EventHandler(this.checkStartup_CheckedChanged);
|
checkStartup.CheckedChanged += checkStartup_CheckedChanged;
|
||||||
//
|
//
|
||||||
// trackBattery
|
// trackBattery
|
||||||
//
|
//
|
||||||
this.trackBattery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
trackBattery.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
trackBattery.LargeChange = 20;
|
||||||
this.trackBattery.LargeChange = 20;
|
trackBattery.Location = new Point(20, 908);
|
||||||
this.trackBattery.Location = new System.Drawing.Point(20, 908);
|
trackBattery.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.trackBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
trackBattery.Maximum = 100;
|
||||||
this.trackBattery.Maximum = 100;
|
trackBattery.Minimum = 50;
|
||||||
this.trackBattery.Minimum = 50;
|
trackBattery.Name = "trackBattery";
|
||||||
this.trackBattery.Name = "trackBattery";
|
trackBattery.Size = new Size(676, 90);
|
||||||
this.trackBattery.Size = new System.Drawing.Size(690, 90);
|
trackBattery.SmallChange = 10;
|
||||||
this.trackBattery.SmallChange = 10;
|
trackBattery.TabIndex = 3;
|
||||||
this.trackBattery.TabIndex = 3;
|
trackBattery.TickFrequency = 10;
|
||||||
this.trackBattery.TickFrequency = 10;
|
trackBattery.TickStyle = TickStyle.TopLeft;
|
||||||
this.trackBattery.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
trackBattery.Value = 100;
|
||||||
this.trackBattery.Value = 100;
|
|
||||||
//
|
//
|
||||||
// labelBatteryTitle
|
// labelBatteryTitle
|
||||||
//
|
//
|
||||||
this.labelBatteryTitle.AutoSize = true;
|
labelBatteryTitle.AutoSize = true;
|
||||||
this.labelBatteryTitle.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
this.labelBatteryTitle.Location = new System.Drawing.Point(77, 871);
|
labelBatteryTitle.Location = new Point(76, 870);
|
||||||
this.labelBatteryTitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelBatteryTitle.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelBatteryTitle.Name = "labelBatteryTitle";
|
labelBatteryTitle.Name = "labelBatteryTitle";
|
||||||
this.labelBatteryTitle.Size = new System.Drawing.Size(248, 32);
|
labelBatteryTitle.Size = new Size(248, 32);
|
||||||
this.labelBatteryTitle.TabIndex = 4;
|
labelBatteryTitle.TabIndex = 4;
|
||||||
this.labelBatteryTitle.Text = "Battery Charge Limit";
|
labelBatteryTitle.Text = "Battery Charge Limit";
|
||||||
//
|
//
|
||||||
// pictureBattery
|
// pictureBattery
|
||||||
//
|
//
|
||||||
this.pictureBattery.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBattery.BackgroundImage")));
|
pictureBattery.BackgroundImage = (Image)resources.GetObject("pictureBattery.BackgroundImage");
|
||||||
this.pictureBattery.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
pictureBattery.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
this.pictureBattery.Location = new System.Drawing.Point(33, 868);
|
pictureBattery.Location = new Point(32, 868);
|
||||||
this.pictureBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
pictureBattery.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.pictureBattery.Name = "pictureBattery";
|
pictureBattery.Name = "pictureBattery";
|
||||||
this.pictureBattery.Size = new System.Drawing.Size(38, 38);
|
pictureBattery.Size = new Size(36, 38);
|
||||||
this.pictureBattery.TabIndex = 6;
|
pictureBattery.TabIndex = 6;
|
||||||
this.pictureBattery.TabStop = false;
|
pictureBattery.TabStop = false;
|
||||||
//
|
//
|
||||||
// labelGPUFan
|
// labelGPUFan
|
||||||
//
|
//
|
||||||
this.labelGPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
labelGPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.labelGPUFan.Location = new System.Drawing.Point(425, 262);
|
labelGPUFan.Location = new Point(410, 262);
|
||||||
this.labelGPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelGPUFan.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelGPUFan.Name = "labelGPUFan";
|
labelGPUFan.Name = "labelGPUFan";
|
||||||
this.labelGPUFan.Size = new System.Drawing.Size(277, 32);
|
labelGPUFan.Size = new Size(276, 32);
|
||||||
this.labelGPUFan.TabIndex = 8;
|
labelGPUFan.TabIndex = 8;
|
||||||
this.labelGPUFan.Text = "GPU Fan : 0%";
|
labelGPUFan.Text = "GPU Fan : 0%";
|
||||||
this.labelGPUFan.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
labelGPUFan.TextAlign = ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// tableGPU
|
// tableGPU
|
||||||
//
|
//
|
||||||
this.tableGPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
tableGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
tableGPU.ColumnCount = 3;
|
||||||
this.tableGPU.ColumnCount = 3;
|
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableGPU.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableGPU.Controls.Add(buttonUltimate, 2, 0);
|
||||||
this.tableGPU.Controls.Add(this.buttonUltimate, 2, 0);
|
tableGPU.Controls.Add(buttonStandard, 1, 0);
|
||||||
this.tableGPU.Controls.Add(this.buttonStandard, 1, 0);
|
tableGPU.Controls.Add(buttonEco, 0, 0);
|
||||||
this.tableGPU.Controls.Add(this.buttonEco, 0, 0);
|
tableGPU.Location = new Point(22, 304);
|
||||||
this.tableGPU.Location = new System.Drawing.Point(22, 303);
|
tableGPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.tableGPU.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
tableGPU.Name = "tableGPU";
|
||||||
this.tableGPU.Name = "tableGPU";
|
tableGPU.RowCount = 1;
|
||||||
this.tableGPU.RowCount = 1;
|
tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 108F));
|
||||||
this.tableGPU.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 107F));
|
tableGPU.Size = new Size(676, 108);
|
||||||
this.tableGPU.Size = new System.Drawing.Size(690, 107);
|
tableGPU.TabIndex = 7;
|
||||||
this.tableGPU.TabIndex = 7;
|
|
||||||
//
|
//
|
||||||
// buttonUltimate
|
// buttonUltimate
|
||||||
//
|
//
|
||||||
this.buttonUltimate.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonUltimate.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonUltimate.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonUltimate.Dock = DockStyle.Fill;
|
||||||
this.buttonUltimate.FlatAppearance.BorderSize = 0;
|
buttonUltimate.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonUltimate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonUltimate.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonUltimate.Location = new System.Drawing.Point(469, 11);
|
buttonUltimate.Location = new Point(458, 12);
|
||||||
this.buttonUltimate.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonUltimate.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonUltimate.Name = "buttonUltimate";
|
buttonUltimate.Name = "buttonUltimate";
|
||||||
this.buttonUltimate.Size = new System.Drawing.Size(212, 85);
|
buttonUltimate.Size = new Size(210, 84);
|
||||||
this.buttonUltimate.TabIndex = 2;
|
buttonUltimate.TabIndex = 2;
|
||||||
this.buttonUltimate.Text = "Ultimate";
|
buttonUltimate.Text = "Ultimate";
|
||||||
this.buttonUltimate.UseVisualStyleBackColor = false;
|
buttonUltimate.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// buttonStandard
|
// buttonStandard
|
||||||
//
|
//
|
||||||
this.buttonStandard.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonStandard.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonStandard.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonStandard.Dock = DockStyle.Fill;
|
||||||
this.buttonStandard.FlatAppearance.BorderSize = 0;
|
buttonStandard.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonStandard.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonStandard.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonStandard.Location = new System.Drawing.Point(239, 11);
|
buttonStandard.Location = new Point(233, 12);
|
||||||
this.buttonStandard.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonStandard.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonStandard.Name = "buttonStandard";
|
buttonStandard.Name = "buttonStandard";
|
||||||
this.buttonStandard.Size = new System.Drawing.Size(212, 85);
|
buttonStandard.Size = new Size(209, 84);
|
||||||
this.buttonStandard.TabIndex = 1;
|
buttonStandard.TabIndex = 1;
|
||||||
this.buttonStandard.Text = "Standard";
|
buttonStandard.Text = "Standard";
|
||||||
this.buttonStandard.UseVisualStyleBackColor = false;
|
buttonStandard.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// buttonEco
|
// buttonEco
|
||||||
//
|
//
|
||||||
this.buttonEco.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonEco.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonEco.CausesValidation = false;
|
buttonEco.CausesValidation = false;
|
||||||
this.buttonEco.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonEco.Dock = DockStyle.Fill;
|
||||||
this.buttonEco.FlatAppearance.BorderSize = 0;
|
buttonEco.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonEco.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonEco.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonEco.Location = new System.Drawing.Point(9, 11);
|
buttonEco.Location = new Point(8, 12);
|
||||||
this.buttonEco.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonEco.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonEco.Name = "buttonEco";
|
buttonEco.Name = "buttonEco";
|
||||||
this.buttonEco.Size = new System.Drawing.Size(212, 85);
|
buttonEco.Size = new Size(209, 84);
|
||||||
this.buttonEco.TabIndex = 0;
|
buttonEco.TabIndex = 0;
|
||||||
this.buttonEco.Text = "Eco";
|
buttonEco.Text = "Eco";
|
||||||
this.buttonEco.UseVisualStyleBackColor = false;
|
buttonEco.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// labelGPU
|
// labelGPU
|
||||||
//
|
//
|
||||||
this.labelGPU.AutoSize = true;
|
labelGPU.AutoSize = true;
|
||||||
this.labelGPU.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
this.labelGPU.Location = new System.Drawing.Point(77, 265);
|
labelGPU.Location = new Point(76, 264);
|
||||||
this.labelGPU.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelGPU.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelGPU.Name = "labelGPU";
|
labelGPU.Name = "labelGPU";
|
||||||
this.labelGPU.Size = new System.Drawing.Size(136, 32);
|
labelGPU.Size = new Size(136, 32);
|
||||||
this.labelGPU.TabIndex = 9;
|
labelGPU.TabIndex = 9;
|
||||||
this.labelGPU.Text = "GPU Mode";
|
labelGPU.Text = "GPU Mode";
|
||||||
//
|
//
|
||||||
// pictureGPU
|
// pictureGPU
|
||||||
//
|
//
|
||||||
this.pictureGPU.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureGPU.BackgroundImage")));
|
pictureGPU.BackgroundImage = (Image)resources.GetObject("pictureGPU.BackgroundImage");
|
||||||
this.pictureGPU.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
pictureGPU.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
this.pictureGPU.Location = new System.Drawing.Point(33, 263);
|
pictureGPU.Location = new Point(32, 262);
|
||||||
this.pictureGPU.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
pictureGPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.pictureGPU.Name = "pictureGPU";
|
pictureGPU.Name = "pictureGPU";
|
||||||
this.pictureGPU.Size = new System.Drawing.Size(38, 38);
|
pictureGPU.Size = new Size(36, 38);
|
||||||
this.pictureGPU.TabIndex = 10;
|
pictureGPU.TabIndex = 10;
|
||||||
this.pictureGPU.TabStop = false;
|
pictureGPU.TabStop = false;
|
||||||
//
|
//
|
||||||
// labelCPUFan
|
// labelCPUFan
|
||||||
//
|
//
|
||||||
this.labelCPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.labelCPUFan.Location = new System.Drawing.Point(425, 38);
|
labelCPUFan.Location = new Point(410, 38);
|
||||||
this.labelCPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelCPUFan.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelCPUFan.Name = "labelCPUFan";
|
labelCPUFan.Name = "labelCPUFan";
|
||||||
this.labelCPUFan.Size = new System.Drawing.Size(277, 32);
|
labelCPUFan.Size = new Size(276, 32);
|
||||||
this.labelCPUFan.TabIndex = 12;
|
labelCPUFan.TabIndex = 12;
|
||||||
this.labelCPUFan.Text = "CPU Fan : 0%";
|
labelCPUFan.Text = "CPU Fan : 0%";
|
||||||
this.labelCPUFan.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
labelCPUFan.TextAlign = ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// tablePerf
|
// tablePerf
|
||||||
//
|
//
|
||||||
this.tablePerf.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
tablePerf.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
tablePerf.ColumnCount = 3;
|
||||||
this.tablePerf.ColumnCount = 3;
|
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tablePerf.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tablePerf.Controls.Add(buttonTurbo, 2, 0);
|
||||||
this.tablePerf.Controls.Add(this.buttonTurbo, 2, 0);
|
tablePerf.Controls.Add(buttonBalanced, 1, 0);
|
||||||
this.tablePerf.Controls.Add(this.buttonBalanced, 1, 0);
|
tablePerf.Controls.Add(buttonSilent, 0, 0);
|
||||||
this.tablePerf.Controls.Add(this.buttonSilent, 0, 0);
|
tablePerf.Location = new Point(22, 76);
|
||||||
this.tablePerf.Location = new System.Drawing.Point(22, 76);
|
tablePerf.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.tablePerf.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
tablePerf.Name = "tablePerf";
|
||||||
this.tablePerf.Name = "tablePerf";
|
tablePerf.RowCount = 1;
|
||||||
this.tablePerf.RowCount = 1;
|
tablePerf.RowStyles.Add(new RowStyle(SizeType.Absolute, 108F));
|
||||||
this.tablePerf.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 107F));
|
tablePerf.Size = new Size(676, 108);
|
||||||
this.tablePerf.Size = new System.Drawing.Size(690, 107);
|
tablePerf.TabIndex = 11;
|
||||||
this.tablePerf.TabIndex = 11;
|
|
||||||
//
|
//
|
||||||
// buttonTurbo
|
// buttonTurbo
|
||||||
//
|
//
|
||||||
this.buttonTurbo.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonTurbo.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonTurbo.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonTurbo.Dock = DockStyle.Fill;
|
||||||
this.buttonTurbo.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
buttonTurbo.FlatAppearance.BorderColor = Color.FromArgb(192, 0, 0);
|
||||||
this.buttonTurbo.FlatAppearance.BorderSize = 0;
|
buttonTurbo.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonTurbo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonTurbo.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonTurbo.Location = new System.Drawing.Point(469, 11);
|
buttonTurbo.Location = new Point(458, 12);
|
||||||
this.buttonTurbo.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonTurbo.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonTurbo.Name = "buttonTurbo";
|
buttonTurbo.Name = "buttonTurbo";
|
||||||
this.buttonTurbo.Size = new System.Drawing.Size(212, 85);
|
buttonTurbo.Size = new Size(210, 84);
|
||||||
this.buttonTurbo.TabIndex = 2;
|
buttonTurbo.TabIndex = 2;
|
||||||
this.buttonTurbo.Text = "Turbo";
|
buttonTurbo.Text = "Turbo";
|
||||||
this.buttonTurbo.UseVisualStyleBackColor = false;
|
buttonTurbo.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// buttonBalanced
|
// buttonBalanced
|
||||||
//
|
//
|
||||||
this.buttonBalanced.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonBalanced.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonBalanced.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonBalanced.Dock = DockStyle.Fill;
|
||||||
this.buttonBalanced.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
|
buttonBalanced.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 192);
|
||||||
this.buttonBalanced.FlatAppearance.BorderSize = 0;
|
buttonBalanced.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonBalanced.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonBalanced.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonBalanced.Location = new System.Drawing.Point(239, 11);
|
buttonBalanced.Location = new Point(233, 12);
|
||||||
this.buttonBalanced.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonBalanced.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonBalanced.Name = "buttonBalanced";
|
buttonBalanced.Name = "buttonBalanced";
|
||||||
this.buttonBalanced.Size = new System.Drawing.Size(212, 85);
|
buttonBalanced.Size = new Size(209, 84);
|
||||||
this.buttonBalanced.TabIndex = 1;
|
buttonBalanced.TabIndex = 1;
|
||||||
this.buttonBalanced.Text = "Balanced";
|
buttonBalanced.Text = "Balanced";
|
||||||
this.buttonBalanced.UseVisualStyleBackColor = false;
|
buttonBalanced.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// buttonSilent
|
// buttonSilent
|
||||||
//
|
//
|
||||||
this.buttonSilent.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
buttonSilent.BackColor = SystemColors.ControlLightLight;
|
||||||
this.buttonSilent.CausesValidation = false;
|
buttonSilent.CausesValidation = false;
|
||||||
this.buttonSilent.Dock = System.Windows.Forms.DockStyle.Fill;
|
buttonSilent.Dock = DockStyle.Fill;
|
||||||
this.buttonSilent.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
|
buttonSilent.FlatAppearance.BorderColor = Color.FromArgb(0, 192, 192);
|
||||||
this.buttonSilent.FlatAppearance.BorderSize = 0;
|
buttonSilent.FlatAppearance.BorderSize = 0;
|
||||||
this.buttonSilent.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonSilent.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonSilent.Location = new System.Drawing.Point(9, 11);
|
buttonSilent.Location = new Point(8, 12);
|
||||||
this.buttonSilent.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
buttonSilent.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.buttonSilent.Name = "buttonSilent";
|
buttonSilent.Name = "buttonSilent";
|
||||||
this.buttonSilent.Size = new System.Drawing.Size(212, 85);
|
buttonSilent.Size = new Size(209, 84);
|
||||||
this.buttonSilent.TabIndex = 0;
|
buttonSilent.TabIndex = 0;
|
||||||
this.buttonSilent.Text = "Silent";
|
buttonSilent.Text = "Silent";
|
||||||
this.buttonSilent.UseVisualStyleBackColor = false;
|
buttonSilent.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// picturePerf
|
// picturePerf
|
||||||
//
|
//
|
||||||
this.picturePerf.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("picturePerf.BackgroundImage")));
|
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
||||||
this.picturePerf.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
this.picturePerf.InitialImage = null;
|
picturePerf.InitialImage = null;
|
||||||
this.picturePerf.Location = new System.Drawing.Point(33, 36);
|
picturePerf.Location = new Point(32, 36);
|
||||||
this.picturePerf.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
picturePerf.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.picturePerf.Name = "picturePerf";
|
picturePerf.Name = "picturePerf";
|
||||||
this.picturePerf.Size = new System.Drawing.Size(38, 38);
|
picturePerf.Size = new Size(36, 38);
|
||||||
this.picturePerf.TabIndex = 14;
|
picturePerf.TabIndex = 14;
|
||||||
this.picturePerf.TabStop = false;
|
picturePerf.TabStop = false;
|
||||||
//
|
//
|
||||||
// labelPerf
|
// labelPerf
|
||||||
//
|
//
|
||||||
this.labelPerf.AutoSize = true;
|
labelPerf.AutoSize = true;
|
||||||
this.labelPerf.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
this.labelPerf.Location = new System.Drawing.Point(77, 38);
|
labelPerf.Location = new Point(76, 38);
|
||||||
this.labelPerf.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelPerf.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelPerf.Name = "labelPerf";
|
labelPerf.Name = "labelPerf";
|
||||||
this.labelPerf.Size = new System.Drawing.Size(234, 32);
|
labelPerf.Size = new Size(234, 32);
|
||||||
this.labelPerf.TabIndex = 13;
|
labelPerf.TabIndex = 13;
|
||||||
this.labelPerf.Text = "Performance Mode";
|
labelPerf.Text = "Performance Mode";
|
||||||
//
|
//
|
||||||
// checkGPU
|
// checkGPU
|
||||||
//
|
//
|
||||||
this.checkGPU.AutoSize = true;
|
checkGPU.AutoSize = true;
|
||||||
this.checkGPU.ForeColor = System.Drawing.SystemColors.GrayText;
|
checkGPU.ForeColor = SystemColors.GrayText;
|
||||||
this.checkGPU.Location = new System.Drawing.Point(33, 411);
|
checkGPU.Location = new Point(32, 412);
|
||||||
this.checkGPU.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
checkGPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.checkGPU.Name = "checkGPU";
|
checkGPU.Name = "checkGPU";
|
||||||
this.checkGPU.Size = new System.Drawing.Size(550, 36);
|
checkGPU.Size = new Size(550, 36);
|
||||||
this.checkGPU.TabIndex = 15;
|
checkGPU.TabIndex = 15;
|
||||||
this.checkGPU.Text = "Set Eco on battery and Standard when plugged";
|
checkGPU.Text = "Set Eco on battery and Standard when plugged";
|
||||||
this.checkGPU.UseVisualStyleBackColor = true;
|
checkGPU.UseVisualStyleBackColor = true;
|
||||||
this.checkGPU.CheckedChanged += new System.EventHandler(this.checkGPU_CheckedChanged);
|
checkGPU.CheckedChanged += checkGPU_CheckedChanged;
|
||||||
//
|
//
|
||||||
// buttonQuit
|
// buttonQuit
|
||||||
//
|
//
|
||||||
this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.buttonQuit.BackColor = System.Drawing.SystemColors.ButtonFace;
|
buttonQuit.BackColor = SystemColors.ButtonFace;
|
||||||
this.buttonQuit.Location = new System.Drawing.Point(591, 1011);
|
buttonQuit.Location = new Point(576, 1008);
|
||||||
this.buttonQuit.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
buttonQuit.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.buttonQuit.Name = "buttonQuit";
|
buttonQuit.Name = "buttonQuit";
|
||||||
this.buttonQuit.Size = new System.Drawing.Size(121, 47);
|
buttonQuit.Size = new Size(120, 48);
|
||||||
this.buttonQuit.TabIndex = 16;
|
buttonQuit.TabIndex = 16;
|
||||||
this.buttonQuit.Text = "Quit";
|
buttonQuit.Text = "Quit";
|
||||||
this.buttonQuit.UseVisualStyleBackColor = false;
|
buttonQuit.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// pictureScreen
|
// pictureScreen
|
||||||
//
|
//
|
||||||
this.pictureScreen.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureScreen.BackgroundImage")));
|
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
|
||||||
this.pictureScreen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
pictureScreen.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
this.pictureScreen.Location = new System.Drawing.Point(33, 496);
|
pictureScreen.Location = new Point(32, 496);
|
||||||
this.pictureScreen.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
pictureScreen.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.pictureScreen.Name = "pictureScreen";
|
pictureScreen.Name = "pictureScreen";
|
||||||
this.pictureScreen.Size = new System.Drawing.Size(38, 38);
|
pictureScreen.Size = new Size(36, 38);
|
||||||
this.pictureScreen.TabIndex = 18;
|
pictureScreen.TabIndex = 18;
|
||||||
this.pictureScreen.TabStop = false;
|
pictureScreen.TabStop = false;
|
||||||
//
|
//
|
||||||
// labelSreen
|
// labelSreen
|
||||||
//
|
//
|
||||||
this.labelSreen.AutoSize = true;
|
labelSreen.AutoSize = true;
|
||||||
this.labelSreen.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
this.labelSreen.Location = new System.Drawing.Point(77, 496);
|
labelSreen.Location = new Point(76, 496);
|
||||||
this.labelSreen.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelSreen.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelSreen.Name = "labelSreen";
|
labelSreen.Name = "labelSreen";
|
||||||
this.labelSreen.Size = new System.Drawing.Size(176, 32);
|
labelSreen.Size = new Size(176, 32);
|
||||||
this.labelSreen.TabIndex = 17;
|
labelSreen.TabIndex = 17;
|
||||||
this.labelSreen.Text = "Laptop Screen";
|
labelSreen.Text = "Laptop Screen";
|
||||||
//
|
//
|
||||||
// tableScreen
|
// tableScreen
|
||||||
//
|
//
|
||||||
this.tableScreen.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
tableScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
tableScreen.ColumnCount = 3;
|
||||||
this.tableScreen.ColumnCount = 3;
|
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
|
||||||
this.tableScreen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
tableScreen.Controls.Add(button120Hz, 1, 0);
|
||||||
this.tableScreen.Controls.Add(this.button120Hz, 1, 0);
|
tableScreen.Controls.Add(button60Hz, 0, 0);
|
||||||
this.tableScreen.Controls.Add(this.button60Hz, 0, 0);
|
tableScreen.Location = new Point(22, 536);
|
||||||
this.tableScreen.Location = new System.Drawing.Point(22, 536);
|
tableScreen.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.tableScreen.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
tableScreen.Name = "tableScreen";
|
||||||
this.tableScreen.Name = "tableScreen";
|
tableScreen.RowCount = 1;
|
||||||
this.tableScreen.RowCount = 1;
|
tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 108F));
|
||||||
this.tableScreen.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 107F));
|
tableScreen.Size = new Size(676, 108);
|
||||||
this.tableScreen.Size = new System.Drawing.Size(690, 102);
|
tableScreen.TabIndex = 19;
|
||||||
this.tableScreen.TabIndex = 19;
|
|
||||||
//
|
//
|
||||||
// button120Hz
|
// button120Hz
|
||||||
//
|
//
|
||||||
this.button120Hz.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
button120Hz.BackColor = SystemColors.ControlLightLight;
|
||||||
this.button120Hz.Dock = System.Windows.Forms.DockStyle.Fill;
|
button120Hz.Dock = DockStyle.Fill;
|
||||||
this.button120Hz.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveBorder;
|
button120Hz.FlatAppearance.BorderColor = SystemColors.ActiveBorder;
|
||||||
this.button120Hz.FlatAppearance.BorderSize = 0;
|
button120Hz.FlatAppearance.BorderSize = 0;
|
||||||
this.button120Hz.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
button120Hz.FlatStyle = FlatStyle.Flat;
|
||||||
this.button120Hz.Location = new System.Drawing.Point(239, 11);
|
button120Hz.Location = new Point(233, 12);
|
||||||
this.button120Hz.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
button120Hz.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.button120Hz.Name = "button120Hz";
|
button120Hz.Name = "button120Hz";
|
||||||
this.button120Hz.Size = new System.Drawing.Size(212, 85);
|
button120Hz.Size = new Size(209, 84);
|
||||||
this.button120Hz.TabIndex = 1;
|
button120Hz.TabIndex = 1;
|
||||||
this.button120Hz.Text = "120Hz + OD";
|
button120Hz.Text = "120Hz + OD";
|
||||||
this.button120Hz.UseVisualStyleBackColor = false;
|
button120Hz.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// button60Hz
|
// button60Hz
|
||||||
//
|
//
|
||||||
this.button60Hz.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
button60Hz.BackColor = SystemColors.ControlLightLight;
|
||||||
this.button60Hz.CausesValidation = false;
|
button60Hz.CausesValidation = false;
|
||||||
this.button60Hz.Dock = System.Windows.Forms.DockStyle.Fill;
|
button60Hz.Dock = DockStyle.Fill;
|
||||||
this.button60Hz.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveBorder;
|
button60Hz.FlatAppearance.BorderColor = SystemColors.ActiveBorder;
|
||||||
this.button60Hz.FlatAppearance.BorderSize = 0;
|
button60Hz.FlatAppearance.BorderSize = 0;
|
||||||
this.button60Hz.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
button60Hz.FlatStyle = FlatStyle.Flat;
|
||||||
this.button60Hz.ForeColor = System.Drawing.SystemColors.ControlText;
|
button60Hz.ForeColor = SystemColors.ControlText;
|
||||||
this.button60Hz.Location = new System.Drawing.Point(9, 11);
|
button60Hz.Location = new Point(8, 12);
|
||||||
this.button60Hz.Margin = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
button60Hz.Margin = new Padding(8, 12, 8, 12);
|
||||||
this.button60Hz.Name = "button60Hz";
|
button60Hz.Name = "button60Hz";
|
||||||
this.button60Hz.Size = new System.Drawing.Size(212, 85);
|
button60Hz.Size = new Size(209, 84);
|
||||||
this.button60Hz.TabIndex = 0;
|
button60Hz.TabIndex = 0;
|
||||||
this.button60Hz.Text = "60Hz";
|
button60Hz.Text = "60Hz";
|
||||||
this.button60Hz.UseVisualStyleBackColor = false;
|
button60Hz.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// checkScreen
|
// checkScreen
|
||||||
//
|
//
|
||||||
this.checkScreen.AutoSize = true;
|
checkScreen.AutoSize = true;
|
||||||
this.checkScreen.ForeColor = System.Drawing.SystemColors.GrayText;
|
checkScreen.ForeColor = SystemColors.GrayText;
|
||||||
this.checkScreen.Location = new System.Drawing.Point(33, 639);
|
checkScreen.Location = new Point(32, 644);
|
||||||
this.checkScreen.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
checkScreen.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.checkScreen.Name = "checkScreen";
|
checkScreen.Name = "checkScreen";
|
||||||
this.checkScreen.Size = new System.Drawing.Size(527, 36);
|
checkScreen.Size = new Size(527, 36);
|
||||||
this.checkScreen.TabIndex = 20;
|
checkScreen.TabIndex = 20;
|
||||||
this.checkScreen.Text = "Set 60Hz on battery, and back when plugged";
|
checkScreen.Text = "Set 60Hz on battery, and back when plugged";
|
||||||
this.checkScreen.UseVisualStyleBackColor = true;
|
checkScreen.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkBoost
|
// checkBoost
|
||||||
//
|
//
|
||||||
this.checkBoost.AutoSize = true;
|
checkBoost.AutoSize = true;
|
||||||
this.checkBoost.ForeColor = System.Drawing.SystemColors.GrayText;
|
checkBoost.ForeColor = SystemColors.GrayText;
|
||||||
this.checkBoost.Location = new System.Drawing.Point(33, 184);
|
checkBoost.Location = new Point(32, 184);
|
||||||
this.checkBoost.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
checkBoost.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.checkBoost.Name = "checkBoost";
|
checkBoost.Name = "checkBoost";
|
||||||
this.checkBoost.Size = new System.Drawing.Size(250, 36);
|
checkBoost.Size = new Size(320, 36);
|
||||||
this.checkBoost.TabIndex = 21;
|
checkBoost.TabIndex = 21;
|
||||||
this.checkBoost.Text = "CPU Boost enabled";
|
checkBoost.Text = "CPU Turbo Boost enabled";
|
||||||
this.checkBoost.UseVisualStyleBackColor = true;
|
checkBoost.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// pictureBox1
|
// pictureBox1
|
||||||
//
|
//
|
||||||
this.pictureBox1.BackgroundImage = global::GHelper.Properties.Resources.icons8_keyboard_48;
|
pictureBox1.BackgroundImage = Properties.Resources.icons8_keyboard_48;
|
||||||
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
this.pictureBox1.Location = new System.Drawing.Point(33, 725);
|
pictureBox1.Location = new Point(32, 724);
|
||||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
pictureBox1.Margin = new Padding(4, 2, 4, 2);
|
||||||
this.pictureBox1.Name = "pictureBox1";
|
pictureBox1.Name = "pictureBox1";
|
||||||
this.pictureBox1.Size = new System.Drawing.Size(36, 36);
|
pictureBox1.Size = new Size(36, 36);
|
||||||
this.pictureBox1.TabIndex = 23;
|
pictureBox1.TabIndex = 23;
|
||||||
this.pictureBox1.TabStop = false;
|
pictureBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
this.label1.Location = new System.Drawing.Point(77, 726);
|
label1.Location = new Point(76, 724);
|
||||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
label1.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(210, 32);
|
label1.Size = new Size(210, 32);
|
||||||
this.label1.TabIndex = 22;
|
label1.TabIndex = 22;
|
||||||
this.label1.Text = "Laptop Keyboard";
|
label1.Text = "Laptop Keyboard";
|
||||||
//
|
//
|
||||||
// comboKeyboard
|
// comboKeyboard
|
||||||
//
|
//
|
||||||
this.comboKeyboard.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
comboKeyboard.FlatStyle = FlatStyle.Flat;
|
||||||
this.comboKeyboard.FormattingEnabled = true;
|
comboKeyboard.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
this.comboKeyboard.ItemHeight = 32;
|
comboKeyboard.FormattingEnabled = true;
|
||||||
this.comboKeyboard.Items.AddRange(new object[] {
|
comboKeyboard.ItemHeight = 37;
|
||||||
"Static",
|
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Strobe", "Rainbow" });
|
||||||
"Breathe",
|
comboKeyboard.Location = new Point(36, 777);
|
||||||
"Strobe",
|
comboKeyboard.Margin = new Padding(0);
|
||||||
"Rainbow"});
|
comboKeyboard.Name = "comboKeyboard";
|
||||||
this.comboKeyboard.Location = new System.Drawing.Point(38, 778);
|
comboKeyboard.Size = new Size(200, 45);
|
||||||
this.comboKeyboard.Margin = new System.Windows.Forms.Padding(0);
|
comboKeyboard.TabIndex = 24;
|
||||||
this.comboKeyboard.Name = "comboKeyboard";
|
comboKeyboard.TabStop = false;
|
||||||
this.comboKeyboard.Size = new System.Drawing.Size(200, 40);
|
|
||||||
this.comboKeyboard.TabIndex = 24;
|
|
||||||
this.comboKeyboard.TabStop = false;
|
|
||||||
//
|
//
|
||||||
// buttonKeyboardColor
|
// buttonKeyboardColor
|
||||||
//
|
//
|
||||||
this.buttonKeyboardColor.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
buttonKeyboardColor.AutoSize = true;
|
||||||
this.buttonKeyboardColor.FlatAppearance.BorderColor = System.Drawing.Color.Red;
|
buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight;
|
||||||
this.buttonKeyboardColor.FlatAppearance.BorderSize = 3;
|
buttonKeyboardColor.FlatAppearance.BorderColor = Color.Red;
|
||||||
this.buttonKeyboardColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
buttonKeyboardColor.FlatAppearance.BorderSize = 2;
|
||||||
this.buttonKeyboardColor.ForeColor = System.Drawing.SystemColors.ControlText;
|
buttonKeyboardColor.FlatStyle = FlatStyle.Flat;
|
||||||
this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773);
|
buttonKeyboardColor.ForeColor = SystemColors.ControlText;
|
||||||
this.buttonKeyboardColor.Margin = new System.Windows.Forms.Padding(0);
|
buttonKeyboardColor.Location = new Point(256, 775);
|
||||||
this.buttonKeyboardColor.Name = "buttonKeyboardColor";
|
buttonKeyboardColor.Margin = new Padding(0);
|
||||||
this.buttonKeyboardColor.Size = new System.Drawing.Size(212, 50);
|
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
||||||
this.buttonKeyboardColor.TabIndex = 25;
|
buttonKeyboardColor.Size = new Size(212, 50);
|
||||||
this.buttonKeyboardColor.Text = "Color";
|
buttonKeyboardColor.TabIndex = 25;
|
||||||
this.buttonKeyboardColor.UseVisualStyleBackColor = false;
|
buttonKeyboardColor.Text = "Color";
|
||||||
//
|
buttonKeyboardColor.UseVisualStyleBackColor = false;
|
||||||
// pictureBox2
|
|
||||||
//
|
|
||||||
this.pictureBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
|
||||||
this.pictureBox2.Location = new System.Drawing.Point(32, 773);
|
|
||||||
this.pictureBox2.Name = "pictureBox2";
|
|
||||||
this.pictureBox2.Size = new System.Drawing.Size(212, 50);
|
|
||||||
this.pictureBox2.TabIndex = 26;
|
|
||||||
this.pictureBox2.TabStop = false;
|
|
||||||
//
|
//
|
||||||
// labelBattery
|
// labelBattery
|
||||||
//
|
//
|
||||||
this.labelBattery.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
labelBattery.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.labelBattery.Location = new System.Drawing.Point(491, 869);
|
labelBattery.Location = new Point(410, 868);
|
||||||
this.labelBattery.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
labelBattery.Margin = new Padding(4, 0, 4, 0);
|
||||||
this.labelBattery.Name = "labelBattery";
|
labelBattery.Name = "labelBattery";
|
||||||
this.labelBattery.Size = new System.Drawing.Size(211, 32);
|
labelBattery.Size = new Size(276, 32);
|
||||||
this.labelBattery.TabIndex = 27;
|
labelBattery.TabIndex = 27;
|
||||||
this.labelBattery.Text = " ";
|
labelBattery.Text = " ";
|
||||||
this.labelBattery.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
labelBattery.TextAlign = ContentAlignment.TopRight;
|
||||||
|
//
|
||||||
|
// buttonFans
|
||||||
|
//
|
||||||
|
buttonFans.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonFans.BackColor = SystemColors.ButtonFace;
|
||||||
|
buttonFans.FlatAppearance.BorderSize = 0;
|
||||||
|
buttonFans.Location = new Point(480, 186);
|
||||||
|
buttonFans.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
buttonFans.Name = "buttonFans";
|
||||||
|
buttonFans.Size = new Size(210, 48);
|
||||||
|
buttonFans.TabIndex = 28;
|
||||||
|
buttonFans.Text = "Fan Profile";
|
||||||
|
buttonFans.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Dpi;
|
||||||
this.ClientSize = new System.Drawing.Size(744, 1093);
|
ClientSize = new Size(730, 1086);
|
||||||
this.Controls.Add(this.labelBattery);
|
Controls.Add(buttonFans);
|
||||||
this.Controls.Add(this.buttonKeyboardColor);
|
Controls.Add(labelBattery);
|
||||||
this.Controls.Add(this.comboKeyboard);
|
Controls.Add(buttonKeyboardColor);
|
||||||
this.Controls.Add(this.pictureBox1);
|
Controls.Add(comboKeyboard);
|
||||||
this.Controls.Add(this.label1);
|
Controls.Add(pictureBox1);
|
||||||
this.Controls.Add(this.checkBoost);
|
Controls.Add(label1);
|
||||||
this.Controls.Add(this.checkScreen);
|
Controls.Add(checkBoost);
|
||||||
this.Controls.Add(this.tableScreen);
|
Controls.Add(checkScreen);
|
||||||
this.Controls.Add(this.pictureScreen);
|
Controls.Add(tableScreen);
|
||||||
this.Controls.Add(this.labelSreen);
|
Controls.Add(pictureScreen);
|
||||||
this.Controls.Add(this.buttonQuit);
|
Controls.Add(labelSreen);
|
||||||
this.Controls.Add(this.checkGPU);
|
Controls.Add(buttonQuit);
|
||||||
this.Controls.Add(this.picturePerf);
|
Controls.Add(checkGPU);
|
||||||
this.Controls.Add(this.labelPerf);
|
Controls.Add(picturePerf);
|
||||||
this.Controls.Add(this.labelCPUFan);
|
Controls.Add(labelPerf);
|
||||||
this.Controls.Add(this.tablePerf);
|
Controls.Add(labelCPUFan);
|
||||||
this.Controls.Add(this.pictureGPU);
|
Controls.Add(tablePerf);
|
||||||
this.Controls.Add(this.labelGPU);
|
Controls.Add(pictureGPU);
|
||||||
this.Controls.Add(this.labelGPUFan);
|
Controls.Add(labelGPU);
|
||||||
this.Controls.Add(this.tableGPU);
|
Controls.Add(labelGPUFan);
|
||||||
this.Controls.Add(this.pictureBattery);
|
Controls.Add(tableGPU);
|
||||||
this.Controls.Add(this.labelBatteryTitle);
|
Controls.Add(pictureBattery);
|
||||||
this.Controls.Add(this.trackBattery);
|
Controls.Add(labelBatteryTitle);
|
||||||
this.Controls.Add(this.checkStartup);
|
Controls.Add(trackBattery);
|
||||||
this.Controls.Add(this.pictureBox2);
|
Controls.Add(checkStartup);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
Margin = new Padding(4, 2, 4, 2);
|
||||||
this.MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
this.MdiChildrenMinimizedAnchorBottom = false;
|
MdiChildrenMinimizedAnchorBottom = false;
|
||||||
this.MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
this.Name = "SettingsForm";
|
Name = "SettingsForm";
|
||||||
this.Padding = new System.Windows.Forms.Padding(9, 11, 9, 11);
|
Padding = new Padding(8, 12, 8, 12);
|
||||||
this.ShowIcon = false;
|
ShowIcon = false;
|
||||||
this.ShowInTaskbar = false;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
Text = "G-Helper";
|
||||||
this.Text = "G-Helper";
|
Load += Settings_Load;
|
||||||
this.Load += new System.EventHandler(this.Settings_Load);
|
((System.ComponentModel.ISupportInitialize)trackBattery).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).EndInit();
|
tableGPU.ResumeLayout(false);
|
||||||
this.tableGPU.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureGPU)).EndInit();
|
tablePerf.ResumeLayout(false);
|
||||||
this.tablePerf.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)picturePerf).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picturePerf)).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureScreen).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).EndInit();
|
tableScreen.ResumeLayout(false);
|
||||||
this.tableScreen.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
PerformLayout();
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -603,7 +597,7 @@
|
|||||||
private Label label1;
|
private Label label1;
|
||||||
private ComboBox comboKeyboard;
|
private ComboBox comboKeyboard;
|
||||||
private Button buttonKeyboardColor;
|
private Button buttonKeyboardColor;
|
||||||
private PictureBox pictureBox2;
|
|
||||||
private Label labelBattery;
|
private Label labelBattery;
|
||||||
|
private Button buttonFans;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
133
Settings.cs
133
Settings.cs
@@ -1,8 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
|
||||||
using Windows.UI.Notifications;
|
|
||||||
using Microsoft.Toolkit.Uwp.Notifications;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -19,6 +17,10 @@ namespace GHelper
|
|||||||
|
|
||||||
static System.Timers.Timer aTimer = default!;
|
static System.Timers.Timer aTimer = default!;
|
||||||
|
|
||||||
|
public string perfName;
|
||||||
|
|
||||||
|
Fans fans;
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -62,13 +64,34 @@ namespace GHelper
|
|||||||
|
|
||||||
buttonKeyboardColor.Click += ButtonKeyboardColor_Click;
|
buttonKeyboardColor.Click += ButtonKeyboardColor_Click;
|
||||||
|
|
||||||
|
buttonFans.Click += ButtonFans_Click;
|
||||||
|
|
||||||
SetTimer();
|
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)
|
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (sender is null)
|
||||||
|
return;
|
||||||
|
|
||||||
Button but = (Button)sender;
|
Button but = (Button)sender;
|
||||||
|
|
||||||
ColorDialog colorDlg = new ColorDialog();
|
ColorDialog colorDlg = new ColorDialog();
|
||||||
@@ -143,6 +166,9 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (sender is null)
|
||||||
|
return;
|
||||||
|
|
||||||
ComboBox cmb = (ComboBox)sender;
|
ComboBox cmb = (ComboBox)sender;
|
||||||
SetAuraMode(cmb.SelectedIndex);
|
SetAuraMode(cmb.SelectedIndex);
|
||||||
}
|
}
|
||||||
@@ -150,6 +176,9 @@ namespace GHelper
|
|||||||
|
|
||||||
private void CheckBoost_Click(object? sender, EventArgs e)
|
private void CheckBoost_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (sender is null)
|
||||||
|
return;
|
||||||
|
|
||||||
CheckBox chk = (CheckBox)sender;
|
CheckBox chk = (CheckBox)sender;
|
||||||
if (chk.Checked)
|
if (chk.Checked)
|
||||||
NativeMethods.SetCPUBoost(3);
|
NativeMethods.SetCPUBoost(3);
|
||||||
@@ -309,34 +338,19 @@ namespace GHelper
|
|||||||
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6) + "%";
|
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6) + "%";
|
||||||
|
|
||||||
string cpuTemp = "";
|
string cpuTemp = "";
|
||||||
string gpuTemp = "";
|
|
||||||
string battery = "";
|
string battery = "";
|
||||||
|
|
||||||
try
|
HardwareMonitor.ReadSensors();
|
||||||
{
|
|
||||||
Program.hwmonitor.ReadSensors();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Debug.WriteLine("Failed reading sensors");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Program.hwmonitor.cpuTemp > 0)
|
if (HardwareMonitor.cpuTemp > 0)
|
||||||
cpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.cpuTemp).ToString() + "°C - ";
|
cpuTemp = ": " + Math.Round((decimal)HardwareMonitor.cpuTemp).ToString() + "°C - ";
|
||||||
|
|
||||||
if (Program.hwmonitor.gpuTemp > 0)
|
if (HardwareMonitor.batteryDischarge > 0)
|
||||||
gpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.gpuTemp).ToString() + "°C - ";
|
battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W";
|
||||||
|
|
||||||
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.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
|
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
|
||||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
|
||||||
Program.settingsForm.labelBattery.Text = battery;
|
Program.settingsForm.labelBattery.Text = battery;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -353,7 +367,7 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
InitScreen();
|
InitScreen();
|
||||||
|
|
||||||
this.Left = Screen.FromControl(this).Bounds.Width - 10 - this.Width;
|
this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width;
|
||||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||||
this.Activate();
|
this.Activate();
|
||||||
|
|
||||||
@@ -364,25 +378,16 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aTimer.Enabled = false;
|
aTimer.Enabled = false;
|
||||||
Program.hwmonitor.StopReading();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
string perfName;
|
|
||||||
|
|
||||||
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
||||||
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
||||||
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
||||||
|
|
||||||
string[] mode = new string[]{
|
|
||||||
"Balanced",
|
|
||||||
"Turbo",
|
|
||||||
"Silent"
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (PerformanceMode)
|
switch (PerformanceMode)
|
||||||
{
|
{
|
||||||
case ASUSWmi.PerformanceSilent:
|
case ASUSWmi.PerformanceSilent:
|
||||||
@@ -400,20 +405,31 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string notifTitle = "Performance Mode Changed";
|
|
||||||
string notifBody = "Switched to: " + mode[PerformanceMode];
|
|
||||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
labelPerf.Text = "Performance Mode: not supported";
|
labelPerf.Text = "Performance Mode: not supported";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(notify)
|
if (fans != null && fans.Text != "")
|
||||||
sendNotification(notifTitle, notifBody);
|
fans.LoadFans();
|
||||||
}
|
|
||||||
|
if (notify) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Program.toast.RunToast(perfName);
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Toast error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void CyclePerformanceMode()
|
public void CyclePerformanceMode()
|
||||||
@@ -421,24 +437,6 @@ namespace GHelper
|
|||||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendNotification(string title, string message)
|
|
||||||
{
|
|
||||||
var content = new ToastContentBuilder()
|
|
||||||
.AddText(title)
|
|
||||||
.AddText(message)
|
|
||||||
.SetToastDuration(ToastDuration.Short)
|
|
||||||
.GetToastContent();
|
|
||||||
|
|
||||||
var notification = new ToastNotification(content.GetXml())
|
|
||||||
{
|
|
||||||
Priority = ToastNotificationPriority.High
|
|
||||||
};
|
|
||||||
|
|
||||||
ToastNotificationManagerCompat.CreateToastNotifier().Show(notification);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void AutoScreen(int Plugged = 1)
|
public void AutoScreen(int Plugged = 1)
|
||||||
{
|
{
|
||||||
int ScreenAuto = Program.config.getConfig("screen_auto");
|
int ScreenAuto = Program.config.getConfig("screen_auto");
|
||||||
@@ -462,7 +460,6 @@ namespace GHelper
|
|||||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||||
|
|
||||||
int GPUMode;
|
|
||||||
|
|
||||||
if (mux == 0) // GPU in Ultimate, ignore
|
if (mux == 0) // GPU in Ultimate, ignore
|
||||||
return;
|
return;
|
||||||
@@ -640,11 +637,11 @@ namespace GHelper
|
|||||||
CheckBox chk = (CheckBox)sender;
|
CheckBox chk = (CheckBox)sender;
|
||||||
if (chk.Checked)
|
if (chk.Checked)
|
||||||
{
|
{
|
||||||
Program.scheduler.Schedule();
|
Startup.Schedule();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Program.scheduler.UnSchedule();
|
Startup.UnSchedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,14 +664,20 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBatteryChange(object sender, EventArgs e)
|
private void trackBatteryChange(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (sender is null)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackBar bar = (TrackBar)sender;
|
TrackBar bar = (TrackBar)sender;
|
||||||
SetBatteryChargeLimit(bar.Value);
|
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;
|
CheckBox chk = (CheckBox)sender;
|
||||||
if (chk.Checked)
|
if (chk.Checked)
|
||||||
Program.config.setConfig("gpu_auto", 1);
|
Program.config.setConfig("gpu_auto", 1);
|
||||||
@@ -683,8 +686,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;
|
CheckBox chk = (CheckBox)sender;
|
||||||
if (chk.Checked)
|
if (chk.Checked)
|
||||||
Program.config.setConfig("screen_auto", 1);
|
Program.config.setConfig("screen_auto", 1);
|
||||||
|
|||||||
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
85
ToastForm.Designer.cs
generated
@@ -1,85 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
108
ToastForm.cs
108
ToastForm.cs
@@ -1,68 +1,94 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Drawing.Drawing2D;
|
||||||
|
using OSD;
|
||||||
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
public partial class ToastForm : Form
|
|
||||||
|
static class Drawing
|
||||||
{
|
{
|
||||||
|
|
||||||
private System.Windows.Forms.Timer timer = default!;
|
public static GraphicsPath RoundedRect(Rectangle bounds, int radius)
|
||||||
|
|
||||||
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);
|
int diameter = radius * 2;
|
||||||
SetWindowPos(frm.Handle.ToInt32(), HWND_TOPMOST,
|
Size size = new Size(diameter, diameter);
|
||||||
frm.Left, frm.Top, frm.Width, frm.Height,
|
Rectangle arc = new Rectangle(bounds.Location, size);
|
||||||
SWP_NOACTIVATE);
|
GraphicsPath path = new GraphicsPath();
|
||||||
|
|
||||||
|
if (radius == 0)
|
||||||
|
{
|
||||||
|
path.AddRectangle(bounds);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
path.AddArc(arc, 180, 90);
|
||||||
|
arc.X = bounds.Right - diameter;
|
||||||
|
path.AddArc(arc, 270, 90);
|
||||||
|
arc.Y = bounds.Bottom - diameter;
|
||||||
|
path.AddArc(arc, 0, 90);
|
||||||
|
arc.X = bounds.Left;
|
||||||
|
path.AddArc(arc, 90, 90);
|
||||||
|
path.CloseFigure();
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastForm()
|
public static void FillRoundedRectangle(this Graphics graphics, Brush brush, Rectangle bounds, int cornerRadius)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
using (GraphicsPath path = RoundedRect(bounds, cornerRadius))
|
||||||
|
{
|
||||||
|
graphics.FillPath(brush, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ToastForm : OSDNativeForm
|
||||||
|
{
|
||||||
|
|
||||||
|
protected static string toastText = "Balanced";
|
||||||
|
protected static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
|
||||||
|
|
||||||
|
protected override void PerformPaint(PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Brush brush = new SolidBrush(Color.FromArgb(150,Color.Black));
|
||||||
|
Drawing.FillRoundedRectangle(e.Graphics, brush, this.Bound, 10);
|
||||||
|
|
||||||
|
StringFormat format = new StringFormat();
|
||||||
|
format.LineAlignment = StringAlignment.Center;
|
||||||
|
format.Alignment = StringAlignment.Center;
|
||||||
|
|
||||||
|
e.Graphics.DrawString(toastText,
|
||||||
|
new Font("Segoe UI", 16f, FontStyle.Bold),
|
||||||
|
new SolidBrush(Color.White),
|
||||||
|
new PointF(this.Bound.Width/2, this.Bound.Height / 2),
|
||||||
|
format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunToast(string text)
|
public void RunToast(string text)
|
||||||
{
|
{
|
||||||
|
|
||||||
Top = Screen.FromControl(this).WorkingArea.Height - this.Height - 100;
|
toastText = text;
|
||||||
Left = (Screen.FromControl(this).Bounds.Width - this.Width) / 2;
|
Screen screen1 = Screen.FromHandle(base.Handle);
|
||||||
|
|
||||||
ShowInactiveTopmost(this);
|
Width = 300;
|
||||||
|
Height = 100;
|
||||||
|
X = (screen1.Bounds.Width - this.Width)/2;
|
||||||
|
Y = screen1.Bounds.Height - 300 - this.Height;
|
||||||
|
|
||||||
labelMode.Text = text;
|
Show();
|
||||||
|
|
||||||
timer = new System.Windows.Forms.Timer();
|
timer.Stop();
|
||||||
timer.Tick += new EventHandler(timer_Tick);
|
timer.Tick -= timer_Tick;
|
||||||
|
|
||||||
|
timer.Tick += timer_Tick;
|
||||||
timer.Enabled = true;
|
timer.Enabled = true;
|
||||||
timer.Interval = 1000;
|
timer.Interval = 2000;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToastForm_Show(object? sender, EventArgs e)
|
private void timer_Tick(object? sender, EventArgs e)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timer_Tick(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
Close();
|
Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
app.manifest
17
app.manifest
@@ -16,7 +16,7 @@
|
|||||||
Remove this element if your application requires this virtualization for backwards
|
Remove this element if your application requires this virtualization for backwards
|
||||||
compatibility.
|
compatibility.
|
||||||
-->
|
-->
|
||||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
</requestedPrivileges>
|
</requestedPrivileges>
|
||||||
</security>
|
</security>
|
||||||
</trustInfo>
|
</trustInfo>
|
||||||
@@ -53,13 +53,16 @@
|
|||||||
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
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">
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
<windowsSettings>
|
<windowsSettings>
|
||||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
||||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
||||||
</windowsSettings>
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
</application>
|
</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>
|
<dependency>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity
|
<assemblyIdentity
|
||||||
|
|||||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
Reference in New Issue
Block a user