Compare commits

...

19 Commits
v0.33 ... v0.38

Author SHA1 Message Date
seerge
9053764930 Speedup update checker 2023-03-23 13:26:09 +01:00
seerge
64871e5554 Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-23 00:38:06 +01:00
seerge
b1c778b30d Minor tweaks 2023-03-23 00:38:03 +01:00
Serge
6932bb1889 Update README.md 2023-03-22 17:55:10 +01:00
seerge
c90a342ce8 Fixed possible memory leack with clock ticks 2023-03-22 17:28:09 +01:00
seerge
f223ca4a33 Added informational toolip 2023-03-22 17:15:20 +01:00
seerge
023607da4b Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-22 14:38:04 +01:00
seerge
264631ab77 Added animatrix Clock 2023-03-22 14:38:01 +01:00
Serge
1bd5d79983 Update README.md 2023-03-21 17:40:06 +01:00
seerge
83b184a061 - 2023-03-21 15:23:41 +01:00
seerge
9ff572b8f6 UI tweaks, mid fan support 2023-03-21 13:14:53 +01:00
seerge
cdb633be04 Anime matrix fixes 2023-03-21 11:11:31 +01:00
seerge
7cb9b1f64f Mid Fan support 2023-03-21 01:24:42 +01:00
seerge
06be8c726e Improved Animatrix rendering 2023-03-20 23:27:13 +01:00
seerge
265c6ce417 - 2023-03-20 21:09:11 +01:00
seerge
add852ce5d Animatrix tweaks 2023-03-20 21:07:05 +01:00
seerge
d4a5164b16 - 2023-03-20 19:18:07 +01:00
seerge
14618ee19e Possible fix for theme switching 2023-03-20 19:04:41 +01:00
seerge
0b3a75e373 Minor tweaks 2023-03-20 18:02:38 +01:00
14 changed files with 611 additions and 233 deletions

View File

@@ -12,6 +12,7 @@ public class ASUSWmi
public const uint CPU_Fan = 0x00110013; public const uint CPU_Fan = 0x00110013;
public const uint GPU_Fan = 0x00110014; public const uint GPU_Fan = 0x00110014;
public const uint Mid_Fan = 0x00110031;
public const uint PerformanceMode = 0x00120075; // Thermal Control public const uint PerformanceMode = 0x00120075; // Thermal Control
@@ -24,6 +25,7 @@ public class ASUSWmi
public const uint DevsCPUFanCurve = 0x00110024; public const uint DevsCPUFanCurve = 0x00110024;
public const uint DevsGPUFanCurve = 0x00110025; public const uint DevsGPUFanCurve = 0x00110025;
public const uint DevsMidFanCurve = 0x00110032;
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 and CPU PPT on 2021 public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 and CPU PPT on 2021
public const int PPT_EDCA1 = 0x001200A1; // CPU EDC public const int PPT_EDCA1 = 0x001200A1; // CPU EDC
@@ -185,12 +187,25 @@ public class ASUSWmi
if (curve.Length != 16) return; if (curve.Length != 16) return;
if (curve.All(singleByte => singleByte == 0)) return; if (curve.All(singleByte => singleByte == 0)) return;
Logger.WriteLine("Fans" + ((device == 1) ? "GPU" : "CPU") + " " + BitConverter.ToString(curve)); string name;
if (device == 1) switch (device)
DeviceSet(DevsGPUFanCurve, curve); {
else case 1:
DeviceSet(DevsCPUFanCurve, curve); DeviceSet(DevsGPUFanCurve, curve);
name = "GPU";
break;
case 2:
DeviceSet(DevsMidFanCurve, curve);
name = "Mid";
break;
default:
DeviceSet(DevsCPUFanCurve, curve);
name = "CPU";
break;
}
Logger.WriteLine("Fans" + name + " " + BitConverter.ToString(curve));
} }
public byte[] GetFanCurve(int device, int mode = 0) public byte[] GetFanCurve(int device, int mode = 0)
@@ -205,10 +220,15 @@ public class ASUSWmi
default: fan_mode = 0; break; default: fan_mode = 0; break;
} }
if (device == 1) switch (device)
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode); {
else case 1:
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode); return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
case 2:
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
default:
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
}
} }

View File

@@ -1,9 +1,8 @@
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me // Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
using Starlight.Communication; using Starlight.Communication;
using System.Diagnostics;
using System.Text;
using System.Management; using System.Management;
using System.Text;
namespace Starlight.AnimeMatrix namespace Starlight.AnimeMatrix
{ {
@@ -68,19 +67,17 @@ namespace Starlight.AnimeMatrix
public class AnimeMatrixDevice : Device public class AnimeMatrixDevice : Device
{ {
private const int UpdatePageLength = 0x0278; int UpdatePageLength = 490;
int LedCount = 1450;
public int LedCount => 1450; byte[] _displayBuffer;
List<byte[]> frames = new List<byte[]>();
private byte[] _displayBuffer = new byte[UpdatePageLength * 3]; public int MaxRows = 61;
private List<byte[]> frames = new List<byte[]>(); public int FullRows = 11;
public int FullEvenRows = -1;
private int pages = 3;
public int MaxColumns = 34; public int MaxColumns = 34;
public int MaxRows = 61;
public int FullRows = 11;
private int frameIndex = 0; private int frameIndex = 0;
@@ -88,15 +85,20 @@ namespace Starlight.AnimeMatrix
: base(0x0B05, 0x193B, 640) : base(0x0B05, 0x193B, 640)
{ {
string model = GetModel(); string model = GetModel();
Debug.WriteLine(model); if (model.Contains("401"))
if (model is not null && model.Contains("401"))
{ {
pages = 2;
FullRows = 6;
MaxColumns = 33; MaxColumns = 33;
FullRows = 7;
FullEvenRows = 1;
MaxRows = 55; MaxRows = 55;
LedCount = 1214;
UpdatePageLength = 410;
} }
_displayBuffer = new byte[LedCount];
} }
@@ -119,7 +121,6 @@ namespace Starlight.AnimeMatrix
public void PresentNextFrame() public void PresentNextFrame()
{ {
//Debug.WriteLine(frameIndex);
if (frameIndex >= frames.Count) frameIndex = 0; if (frameIndex >= frames.Count) frameIndex = 0;
_displayBuffer = frames[frameIndex]; _displayBuffer = frames[frameIndex];
Present(); Present();
@@ -143,27 +144,25 @@ namespace Starlight.AnimeMatrix
} }
public int EmptyColumns(int row) public int XStart(int row)
{ {
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0); return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
} }
public int Columns(int row)
public int XEnd(int row)
{ {
EnsureRowInRange(row); if (row <= FullEvenRows && row % 2 == 0) return MaxColumns - 1;
return MaxColumns - EmptyColumns(row); return MaxColumns;
} }
public int RowToLinearAddress(int row) public int RowToLinearAddress(int row)
{ {
EnsureRowInRange(row); EnsureRowInRange(row);
var ret = 0; int ret = 0;
if (row > 0) for (var i = 0; i < row; i++)
{ ret += XEnd(i) - XStart(i);
for (var i = 0; i < row; i++)
ret += Columns(i);
}
return ret; return ret;
} }
@@ -175,13 +174,13 @@ namespace Starlight.AnimeMatrix
public void SetLedLinear(int address, byte value) public void SetLedLinear(int address, byte value)
{ {
EnsureAddressableLed(address); if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value; _displayBuffer[address] = value;
} }
public void SetLedLinearImmediate(int address, byte value) public void SetLedLinearImmediate(int address, byte value)
{ {
EnsureAddressableLed(address); if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value; _displayBuffer[address] = value;
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
@@ -196,10 +195,11 @@ namespace Starlight.AnimeMatrix
public void SetLedPlanar(int x, int y, byte value) public void SetLedPlanar(int x, int y, byte value)
{ {
EnsureRowInRange(y); EnsureRowInRange(y);
var start = RowToLinearAddress(y) - EmptyColumns(y); var start = RowToLinearAddress(y) - XStart(y);
if (x >= XStart(y) && x < XEnd(y))
if (x > EmptyColumns(y)) {
SetLedLinear(start + x, value); SetLedLinear(start + x, value);
}
} }
public void Clear(bool present = false) public void Clear(bool present = false)
@@ -214,26 +214,23 @@ namespace Starlight.AnimeMatrix
public void Present() public void Present()
{ {
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) int page = 0;
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1))) int start, end;
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
.AppendData(_displayBuffer[(UpdatePageLength * 0)..(UpdatePageLength * 1)])
);
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) while (page * UpdatePageLength < LedCount)
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 1 + 1))) {
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength)) start = page * UpdatePageLength;
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)]) end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
);
if (pages > 2)
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1))) .AppendData(BitConverter.GetBytes((ushort)(start + 1)))
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2))) .AppendData(BitConverter.GetBytes((ushort)(end - start)))
.AppendData( .AppendData(_displayBuffer[start..end])
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
); );
page++;
}
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03)); Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
} }
@@ -270,6 +267,37 @@ namespace Starlight.AnimeMatrix
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte)); Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
} }
public void PresentText(string text, float fontSize = 8F)
{
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
{
using (Graphics g = Graphics.FromImage(bmp))
{
using (Font font = new Font("Arial", fontSize))
{
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
/*
SizeF textSize = g.MeasureString(text, font);
g.TranslateTransform(bmp.Width / 2, bmp.Height / 2);
g.RotateTransform(33);
g.DrawString(text, font, Brushes.White, -textSize.Width/2, -textSize.Height / 2);
*/
g.DrawString(text, font, Brushes.White, 12, -2);
}
}
GenerateFrame(bmp);
Present();
}
}
public void GenerateFrame(Image image) public void GenerateFrame(Image image)
{ {
@@ -277,32 +305,36 @@ namespace Starlight.AnimeMatrix
int height = MaxRows; int height = MaxRows;
float scale; float scale;
Bitmap canvas = new Bitmap(width, height); using (Bitmap canvas = new Bitmap(width, height))
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
var graph = Graphics.FromImage(canvas);
var scaleWidth = (int)(image.Width * scale);
var scaleHeight = (int)(image.Height * scale);
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
Bitmap bmp = new Bitmap(canvas, MaxColumns, MaxRows);
for (int y = 0; y < bmp.Height; y++)
{ {
for (int x = 0; x < bmp.Width; x++) scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
using (var graph = Graphics.FromImage(canvas))
{ {
var pixel = bmp.GetPixel(x, y); var scaleWidth = (int)(image.Width * scale);
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0)); var scaleHeight = (int)(image.Height * scale);
SetLedPlanar(x, y, color);
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
}
using (Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows))
{
for (int y = 0; y < bmp.Height; y++)
for (int x = 0; x < bmp.Width; x++)
if (x % 2 == y % 2)
{
var pixel = bmp.GetPixel(x, y);
SetLedPlanar(x / 2, y, (byte)((pixel.R + pixel.G + pixel.B)/3));
}
} }
} }
} }
private void EnsureRowInRange(int row) private void EnsureRowInRange(int row)
@@ -313,12 +345,9 @@ namespace Starlight.AnimeMatrix
} }
} }
private void EnsureAddressableLed(int address) private bool IsAddressableLed(int address)
{ {
if (address < 0 || address >= LedCount) return (address >= 0 && address < LedCount);
{
throw new IndexOutOfRangeException($"Linear LED address must be in range of [0, {LedCount - 1}].");
}
} }
} }
} }

View File

@@ -6,33 +6,37 @@ public static class ControlHelper
{ {
static bool _invert = false; static bool _invert = false;
static bool _resize = false;
static float _scale = 1; static float _scale = 1;
static Color formBack; static Color formBack;
static Color backMain; static Color backMain;
static Color foreMain; static Color foreMain;
static Color foreAccent;
static Color borderMain; static Color borderMain;
static Color buttonMain; static Color buttonMain;
public static void Adjust(RForm container, float baseScale = 2, bool invert = false) public static void Adjust(RForm container, bool darkTheme = false, bool invert = false)
{ {
_scale = GetDpiScale(container).Value / baseScale;
if (container.darkTheme) if (darkTheme)
{ {
formBack = Color.FromArgb(255, 35, 35, 35); formBack = Color.FromArgb(255, 35, 35, 35);
backMain = Color.FromArgb(255, 50, 50, 50); backMain = Color.FromArgb(255, 50, 50, 50);
foreMain = Color.White; foreMain = Color.White;
foreAccent = Color.FromArgb(255, 100, 100, 100);
borderMain = Color.FromArgb(255, 50, 50, 50); borderMain = Color.FromArgb(255, 50, 50, 50);
buttonMain = Color.FromArgb(255, 100, 100, 100); buttonMain = Color.FromArgb(255, 80, 80, 80);
} }
else else
{ {
formBack = SystemColors.Control; formBack = SystemColors.Control;
backMain = SystemColors.ControlLightLight; backMain = SystemColors.ControlLightLight;
foreMain = SystemColors.ControlText; foreMain = SystemColors.ControlText;
foreAccent = Color.LightGray;
borderMain = Color.LightGray; borderMain = Color.LightGray;
buttonMain = SystemColors.ControlLight; buttonMain = Color.FromArgb(255, 230, 230, 230);
} }
container.BackColor = formBack; container.BackColor = formBack;
@@ -41,6 +45,30 @@ public static class ControlHelper
_invert = invert; _invert = invert;
AdjustControls(container.Controls); AdjustControls(container.Controls);
_invert = false; _invert = false;
}
public static void Resize(RForm container, float baseScale = 2)
{
_scale = GetDpiScale(container).Value / baseScale;
ResizeControls(container.Controls);
}
private static void ResizeControls(Control.ControlCollection controls)
{
foreach (Control control in controls)
{
var button = control as RButton;
if (button != null && button.Image is not null)
button.Image = ResizeImage(button.Image);
var pictureBox = control as PictureBox;
if (pictureBox != null && pictureBox.BackgroundImage is not null)
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
ResizeControls(control.Controls);
}
} }
@@ -48,10 +76,10 @@ public static class ControlHelper
{ {
foreach (Control control in controls) foreach (Control control in controls)
{ {
var button = control as Button; var button = control as RButton;
if (button != null) if (button != null)
{ {
button.BackColor = backMain; button.BackColor = button.Secondary ? buttonMain : backMain;
button.ForeColor = foreMain; button.ForeColor = foreMain;
button.FlatStyle = FlatStyle.Flat; button.FlatStyle = FlatStyle.Flat;
@@ -62,12 +90,10 @@ public static class ControlHelper
} }
var pictureBox = control as PictureBox; var pictureBox = control as PictureBox;
if (pictureBox != null) if (pictureBox != null && pictureBox.BackgroundImage is not null)
{ pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
if (pictureBox.BackgroundImage is not null)
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
}
var combo = control as RComboBox; var combo = control as RComboBox;
if (combo != null) if (combo != null)
{ {
@@ -89,8 +115,8 @@ public static class ControlHelper
{ {
chart.BackColor = backMain; chart.BackColor = backMain;
chart.ChartAreas[0].BackColor = backMain; chart.ChartAreas[0].BackColor = backMain;
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreMain; chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreMain; chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisX.TitleForeColor = foreMain; chart.ChartAreas[0].AxisX.TitleForeColor = foreMain;
chart.ChartAreas[0].AxisY.TitleForeColor = foreMain; chart.ChartAreas[0].AxisY.TitleForeColor = foreMain;
@@ -101,8 +127,8 @@ public static class ControlHelper
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain; chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain; chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisX.LineColor = foreMain; chart.ChartAreas[0].AxisX.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.LineColor = foreMain; chart.ChartAreas[0].AxisY.LineColor = foreAccent;
chart.Titles[0].ForeColor = foreMain; chart.Titles[0].ForeColor = foreMain;
@@ -121,7 +147,7 @@ public static class ControlHelper
}); });
} }
private static Image AdjustImage(Image image) private static Image ResizeImage(Image image)
{ {
var newSize = new Size((int)(image.Width * _scale), (int)(image.Height * _scale)); var newSize = new Size((int)(image.Width * _scale), (int)(image.Height * _scale));
var pic = new Bitmap(newSize.Width, newSize.Height); var pic = new Bitmap(newSize.Width, newSize.Height);
@@ -131,6 +157,12 @@ public static class ControlHelper
g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(image, new Rectangle(new Point(), newSize)); g.DrawImage(image, new Rectangle(new Point(), newSize));
} }
return pic;
}
private static Image AdjustImage(Image image)
{
var pic = new Bitmap(image);
if (_invert) if (_invert)
{ {
@@ -145,6 +177,7 @@ public static class ControlHelper
} }
return pic; return pic;
} }
} }

View File

@@ -1,4 +1,5 @@
using System.ComponentModel; using Microsoft.Win32;
using System.ComponentModel;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -19,24 +20,41 @@ namespace CustomControls
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize); private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
public bool darkTheme; public bool darkTheme;
public bool invert = false;
public void InitTheme() private static bool IsDarkTheme()
{ {
bool newDarkTheme = CheckSystemDarkModeStatus(); using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
invert = (darkTheme != newDarkTheme); var registryValueObject = key?.GetValue("AppsUseLightTheme");
if (registryValueObject == null) return false;
return (int)registryValueObject <= 0;
}
public void InitTheme(bool setDPI = true)
{
bool newDarkTheme = IsDarkTheme();
bool changed = (darkTheme != newDarkTheme);
darkTheme = newDarkTheme; darkTheme = newDarkTheme;
ControlHelper.Adjust(this, 2, invert); if (setDPI)
try ControlHelper.Resize(this);
if (changed)
{ {
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4); DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
} catch { } ControlHelper.Adjust(this, darkTheme, changed);
}
} }
} }
public class RTrackBar : TrackBar
{
}
public class RComboBox : ComboBox public class RComboBox : ComboBox
{ {
private Color borderColor = Color.Gray; private Color borderColor = Color.Gray;
@@ -53,8 +71,8 @@ namespace CustomControls
} }
} }
} }
private Color buttonColor = Color.LightGray; private Color buttonColor = Color.FromArgb(255,230, 230, 230);
[DefaultValue(typeof(Color), "LightGray")] [DefaultValue(typeof(Color), "230, 230, 230")]
public Color ButtonColor public Color ButtonColor
{ {
get { return buttonColor; } get { return buttonColor; }
@@ -221,10 +239,18 @@ namespace CustomControls
{ {
//Fields //Fields
private int borderSize = 5; private int borderSize = 5;
private int borderRadius = 3;
private bool activated = false;
private Color borderColor = Color.Transparent;
private int borderRadius = 5;
public int BorderRadius
{
get { return borderRadius; }
set
{
borderRadius = value;
}
}
private Color borderColor = Color.Transparent;
public Color BorderColor public Color BorderColor
{ {
get { return borderColor; } get { return borderColor; }
@@ -235,6 +261,7 @@ namespace CustomControls
} }
private bool activated = false;
public bool Activated public bool Activated
{ {
get { return activated; } get { return activated; }
@@ -247,6 +274,15 @@ namespace CustomControls
} }
} }
private bool secondary = false;
public bool Secondary
{
get { return secondary; }
set
{
secondary = value;
}
}
public RButton() public RButton()
{ {

120
app/CustomControls.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

89
app/Fans.Designer.cs generated
View File

@@ -31,10 +31,12 @@ namespace GHelper
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
ChartArea chartArea1 = new ChartArea();
Title title1 = new Title();
ChartArea chartArea2 = new ChartArea();
Title title2 = new Title();
ChartArea chartArea3 = new ChartArea(); ChartArea chartArea3 = new ChartArea();
Title title3 = new Title(); Title title3 = new Title();
ChartArea chartArea4 = new ChartArea();
Title title4 = new Title();
panelFans = new Panel(); panelFans = new Panel();
labelTip = new Label(); labelTip = new Label();
labelBoost = new Label(); labelBoost = new Label();
@@ -43,6 +45,7 @@ namespace GHelper
tableFanCharts = new TableLayoutPanel(); tableFanCharts = new TableLayoutPanel();
chartGPU = new Chart(); chartGPU = new Chart();
chartCPU = new Chart(); chartCPU = new Chart();
chartMid = new Chart();
labelFans = new Label(); labelFans = new Label();
checkAuto = new CheckBox(); checkAuto = new CheckBox();
buttonReset = new RButton(); buttonReset = new RButton();
@@ -68,6 +71,7 @@ namespace GHelper
tableFanCharts.SuspendLayout(); tableFanCharts.SuspendLayout();
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit(); ((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit(); ((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
((System.ComponentModel.ISupportInitialize)chartMid).BeginInit();
panelPower.SuspendLayout(); panelPower.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
panelCPU.SuspendLayout(); panelCPU.SuspendLayout();
@@ -147,44 +151,59 @@ namespace GHelper
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableFanCharts.Controls.Add(chartGPU, 0, 1); tableFanCharts.Controls.Add(chartGPU, 0, 1);
tableFanCharts.Controls.Add(chartCPU, 0, 0); tableFanCharts.Controls.Add(chartCPU, 0, 0);
tableFanCharts.Controls.Add(chartMid, 0, 2);
tableFanCharts.Location = new Point(28, 64); tableFanCharts.Location = new Point(28, 64);
tableFanCharts.Margin = new Padding(6); tableFanCharts.Margin = new Padding(6);
tableFanCharts.Name = "tableFanCharts"; tableFanCharts.Name = "tableFanCharts";
tableFanCharts.RowCount = 2; tableFanCharts.RowCount = 2;
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableFanCharts.Size = new Size(764, 992); tableFanCharts.Size = new Size(764, 992);
tableFanCharts.TabIndex = 36; tableFanCharts.TabIndex = 36;
// //
// chartGPU // chartGPU
// //
chartArea3.Name = "ChartArea1"; chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea3); chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Dock = DockStyle.Fill; chartGPU.Dock = DockStyle.Fill;
chartGPU.Location = new Point(2, 506); chartGPU.Location = new Point(2, 340);
chartGPU.Margin = new Padding(2, 10, 2, 10); chartGPU.Margin = new Padding(2, 10, 2, 10);
chartGPU.Name = "chartGPU"; chartGPU.Name = "chartGPU";
chartGPU.Size = new Size(760, 476); chartGPU.Size = new Size(760, 310);
chartGPU.TabIndex = 17; chartGPU.TabIndex = 17;
chartGPU.Text = "chart1"; chartGPU.Text = "chartGPU";
title3.Name = "Title1"; title1.Name = "Title1";
chartGPU.Titles.Add(title3); chartGPU.Titles.Add(title1);
// //
// chartCPU // chartCPU
// //
chartArea4.Name = "ChartArea1"; chartArea2.Name = "ChartArea1";
chartCPU.ChartAreas.Add(chartArea4); chartCPU.ChartAreas.Add(chartArea2);
chartCPU.Dock = DockStyle.Fill; chartCPU.Dock = DockStyle.Fill;
chartCPU.Location = new Point(2, 10); chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10); chartCPU.Margin = new Padding(2, 10, 2, 10);
chartCPU.Name = "chartCPU"; chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(760, 476); chartCPU.Size = new Size(760, 310);
chartCPU.TabIndex = 14; chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU"; chartCPU.Text = "chartCPU";
title4.Name = "Title1"; title2.Name = "Title1";
chartCPU.Titles.Add(title4); chartCPU.Titles.Add(title2);
//
// chartMid
//
chartArea3.Name = "ChartArea3";
chartMid.ChartAreas.Add(chartArea3);
chartMid.Dock = DockStyle.Fill;
chartMid.Location = new Point(2, 670);
chartMid.Margin = new Padding(2, 10, 2, 10);
chartMid.Name = "chartMid";
chartMid.Size = new Size(760, 312);
chartMid.TabIndex = 14;
chartMid.Text = "chartMid";
title3.Name = "Title3";
chartMid.Titles.Add(title3);
chartMid.Visible = false;
// //
// labelFans // labelFans
// //
@@ -213,12 +232,14 @@ namespace GHelper
// //
buttonReset.Activated = false; buttonReset.Activated = false;
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonReset.BackColor = SystemColors.ControlLight; buttonReset.BackColor = Color.FromArgb(230, 230, 230);
buttonReset.BorderColor = Color.Transparent; buttonReset.BorderColor = Color.Transparent;
buttonReset.BorderRadius = 2;
buttonReset.FlatStyle = FlatStyle.Flat; buttonReset.FlatStyle = FlatStyle.Flat;
buttonReset.Location = new Point(30, 1081); buttonReset.Location = new Point(30, 1081);
buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Margin = new Padding(4, 2, 4, 2);
buttonReset.Name = "buttonReset"; buttonReset.Name = "buttonReset";
buttonReset.Secondary = true;
buttonReset.Size = new Size(232, 44); buttonReset.Size = new Size(232, 44);
buttonReset.TabIndex = 15; buttonReset.TabIndex = 15;
buttonReset.Text = "Factory Defaults"; buttonReset.Text = "Factory Defaults";
@@ -228,15 +249,17 @@ namespace GHelper
// //
buttonApply.Activated = false; buttonApply.Activated = false;
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonApply.BackColor = SystemColors.ControlLight; buttonApply.BackColor = Color.FromArgb(230, 230, 230);
buttonApply.BorderColor = Color.Transparent; buttonApply.BorderColor = Color.Transparent;
buttonApply.BorderRadius = 2;
buttonApply.FlatStyle = FlatStyle.Flat; buttonApply.FlatStyle = FlatStyle.Flat;
buttonApply.Location = new Point(542, 1081); buttonApply.Location = new Point(542, 1081);
buttonApply.Margin = new Padding(4, 2, 4, 2); buttonApply.Margin = new Padding(4, 2, 4, 2);
buttonApply.Name = "buttonApply"; buttonApply.Name = "buttonApply";
buttonApply.Secondary = true;
buttonApply.Size = new Size(248, 44); buttonApply.Size = new Size(248, 44);
buttonApply.TabIndex = 14; buttonApply.TabIndex = 14;
buttonApply.Text = "Apply Fan Curve"; buttonApply.Text = "Apply Custom Curve";
buttonApply.UseVisualStyleBackColor = false; buttonApply.UseVisualStyleBackColor = false;
// //
// panelPower // panelPower
@@ -297,12 +320,14 @@ namespace GHelper
// //
buttonApplyPower.Activated = false; buttonApplyPower.Activated = false;
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonApplyPower.BackColor = SystemColors.ControlLight; buttonApplyPower.BackColor = Color.FromArgb(230, 230, 230);
buttonApplyPower.BorderColor = Color.Transparent; buttonApplyPower.BorderColor = Color.Transparent;
buttonApplyPower.BorderRadius = 2;
buttonApplyPower.FlatStyle = FlatStyle.Flat; buttonApplyPower.FlatStyle = FlatStyle.Flat;
buttonApplyPower.Location = new Point(20, 1081); buttonApplyPower.Location = new Point(20, 1081);
buttonApplyPower.Margin = new Padding(4, 2, 4, 2); buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
buttonApplyPower.Name = "buttonApplyPower"; buttonApplyPower.Name = "buttonApplyPower";
buttonApplyPower.Secondary = true;
buttonApplyPower.Size = new Size(324, 44); buttonApplyPower.Size = new Size(324, 44);
buttonApplyPower.TabIndex = 24; buttonApplyPower.TabIndex = 24;
buttonApplyPower.Text = "Apply Power Limits"; buttonApplyPower.Text = "Apply Power Limits";
@@ -321,12 +346,11 @@ namespace GHelper
// //
// labelCPU // labelCPU
// //
labelCPU.AutoSize = true;
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelCPU.Location = new Point(44, 40); labelCPU.Location = new Point(13, 40);
labelCPU.Margin = new Padding(4, 0, 4, 0); labelCPU.Margin = new Padding(4, 0, 4, 0);
labelCPU.Name = "labelCPU"; labelCPU.Name = "labelCPU";
labelCPU.Size = new Size(61, 32); labelCPU.Size = new Size(120, 32);
labelCPU.TabIndex = 13; labelCPU.TabIndex = 13;
labelCPU.Text = "CPU"; labelCPU.Text = "CPU";
labelCPU.TextAlign = ContentAlignment.MiddleCenter; labelCPU.TextAlign = ContentAlignment.MiddleCenter;
@@ -368,25 +392,24 @@ namespace GHelper
// //
// labelTotal // labelTotal
// //
labelTotal.AutoSize = true;
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTotal.Location = new Point(46, 40); labelTotal.Location = new Point(16, 40);
labelTotal.Margin = new Padding(4, 0, 4, 0); labelTotal.Margin = new Padding(4, 0, 4, 0);
labelTotal.Name = "labelTotal"; labelTotal.Name = "labelTotal";
labelTotal.Size = new Size(70, 32); labelTotal.Size = new Size(122, 32);
labelTotal.TabIndex = 12; labelTotal.TabIndex = 12;
labelTotal.Text = "Total"; labelTotal.Text = "Platform";
labelTotal.TextAlign = ContentAlignment.MiddleCenter; labelTotal.TextAlign = ContentAlignment.MiddleCenter;
// //
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(48, 8); label1.Location = new Point(26, 8);
label1.Margin = new Padding(4, 0, 4, 0); label1.Margin = new Padding(4, 0, 4, 0);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(65, 32); label1.Size = new Size(104, 32);
label1.TabIndex = 11; label1.TabIndex = 11;
label1.Text = "Total"; label1.Text = "Platform";
label1.TextAlign = ContentAlignment.MiddleCenter; label1.TextAlign = ContentAlignment.MiddleCenter;
// //
// trackTotal // trackTotal
@@ -462,6 +485,7 @@ namespace GHelper
tableFanCharts.ResumeLayout(false); tableFanCharts.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit(); ((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit(); ((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
((System.ComponentModel.ISupportInitialize)chartMid).EndInit();
panelPower.ResumeLayout(false); panelPower.ResumeLayout(false);
panelPower.PerformLayout(); panelPower.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
@@ -498,6 +522,7 @@ namespace GHelper
private TableLayoutPanel tableFanCharts; private TableLayoutPanel tableFanCharts;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU; private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU; private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
private System.Windows.Forms.DataVisualization.Charting.Chart chartMid;
private Label labelFans; private Label labelFans;
private PictureBox picturePerf; private PictureBox picturePerf;
private PictureBox pictureBox1; private PictureBox pictureBox1;

View File

@@ -10,6 +10,7 @@ namespace GHelper
DataPoint curPoint = null; DataPoint curPoint = null;
Series seriesCPU; Series seriesCPU;
Series seriesGPU; Series seriesGPU;
Series seriesMid;
static int MinRPM, MaxRPM; static int MinRPM, MaxRPM;
@@ -27,6 +28,8 @@ namespace GHelper
if (device == 1) if (device == 1)
title = "GPU Fan Profile"; title = "GPU Fan Profile";
else if (device == 2)
title = "Middle Fan Profile";
else else
title = "CPU Fan Profile"; title = "CPU Fan Profile";
@@ -35,9 +38,6 @@ namespace GHelper
chart.Titles[0].Text = title; chart.Titles[0].Text = title;
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisX.Minimum = 10; chart.ChartAreas[0].AxisX.Minimum = 10;
chart.ChartAreas[0].AxisX.Maximum = 100; chart.ChartAreas[0].AxisX.Maximum = 100;
chart.ChartAreas[0].AxisX.Interval = 10; chart.ChartAreas[0].AxisX.Interval = 10;
@@ -100,9 +100,11 @@ namespace GHelper
seriesCPU = chartCPU.Series.Add("CPU"); seriesCPU = chartCPU.Series.Add("CPU");
seriesGPU = chartGPU.Series.Add("GPU"); seriesGPU = chartGPU.Series.Add("GPU");
seriesMid = chartMid.Series.Add("Mid");
seriesCPU.Color = colorStandard; seriesCPU.Color = colorStandard;
seriesGPU.Color = colorTurbo; seriesGPU.Color = colorTurbo;
seriesMid.Color = colorEco;
chartCPU.MouseMove += ChartCPU_MouseMove; chartCPU.MouseMove += ChartCPU_MouseMove;
chartCPU.MouseUp += ChartCPU_MouseUp; chartCPU.MouseUp += ChartCPU_MouseUp;
@@ -110,6 +112,9 @@ namespace GHelper
chartGPU.MouseMove += ChartCPU_MouseMove; chartGPU.MouseMove += ChartCPU_MouseMove;
chartGPU.MouseUp += ChartCPU_MouseUp; chartGPU.MouseUp += ChartCPU_MouseUp;
chartMid.MouseMove += ChartCPU_MouseMove;
chartMid.MouseUp += ChartCPU_MouseUp;
buttonReset.Click += ButtonReset_Click; buttonReset.Click += ButtonReset_Click;
buttonApply.Click += ButtonApply_Click; buttonApply.Click += ButtonApply_Click;
@@ -267,6 +272,22 @@ namespace GHelper
public void InitFans() public void InitFans()
{ {
byte[] curve = Program.wmi.GetFanCurve(2);
if (curve.All(singleByte => singleByte == 0))
{
Program.config.setConfig("mid_fan", 0);
}
else
{
Program.config.setConfig("mid_fan", 1);
chartMid.Visible = true;
SetChart(chartMid, 2);
LoadProfile(seriesMid, 2);
}
SetChart(chartCPU, 0); SetChart(chartCPU, 0);
SetChart(chartGPU, 1); SetChart(chartGPU, 1);
@@ -331,6 +352,8 @@ namespace GHelper
{ {
ApplyProfile(seriesCPU, 0); ApplyProfile(seriesCPU, 0);
ApplyProfile(seriesGPU, 1); ApplyProfile(seriesGPU, 1);
if (Program.config.getConfig("mid_fan") == 1)
ApplyProfile(seriesMid, 2);
} }
private void ButtonReset_Click(object? sender, EventArgs e) private void ButtonReset_Click(object? sender, EventArgs e)
@@ -338,6 +361,8 @@ namespace GHelper
LoadProfile(seriesCPU, 0, 1); LoadProfile(seriesCPU, 0, 1);
LoadProfile(seriesGPU, 1, 1); LoadProfile(seriesGPU, 1, 1);
if (Program.config.getConfig("mid_fan") == 1)
LoadProfile(seriesMid, 2, 1);
checkAuto.Checked = false; checkAuto.Checked = false;
checkApplyPower.Checked = false; checkApplyPower.Checked = false;

View File

@@ -16,7 +16,7 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.34</AssemblyVersion> <AssemblyVersion>0.37</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -85,10 +85,7 @@ public static class HardwareMonitor
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine(ex.ToString());
} }
finally
{
Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
}
} }
} }

View File

@@ -49,13 +49,16 @@ namespace GHelper
} }
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
Application.EnableVisualStyles(); Application.EnableVisualStyles();
SystemEvents.UserPreferenceChanged += new
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
ds = settingsForm.Handle; ds = settingsForm.Handle;
trayIcon.MouseClick += TrayIcon_MouseClick; ; trayIcon.MouseClick += TrayIcon_MouseClick;
wmi.SubscribeToEvents(WatcherEventArrived); wmi.SubscribeToEvents(WatcherEventArrived);
@@ -75,13 +78,22 @@ namespace GHelper
// Subscribing for system power change events // Subscribing for system power change events
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
settingsForm.SetVersionLabel("Version: " + Assembly.GetExecutingAssembly().GetName().Version);
CheckForUpdates(); CheckForUpdates();
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
{
SettingsToggle();
}
Application.Run(); Application.Run();
} }
static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{ {
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return; if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
@@ -91,13 +103,14 @@ namespace GHelper
{ {
case UserPreferenceCategory.General: case UserPreferenceCategory.General:
Debug.WriteLine("Theme Changed"); Debug.WriteLine("Theme Changed");
settingsForm.InitTheme(); Thread.Sleep(500);
settingsForm.InitTheme(false);
if (settingsForm.fans is not null && settingsForm.fans.Text != "") if (settingsForm.fans is not null && settingsForm.fans.Text != "")
settingsForm.fans.InitTheme(); settingsForm.fans.InitTheme(false);
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "") if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
settingsForm.keyb.InitTheme(); settingsForm.keyb.InitTheme(false);
break; break;
} }
@@ -107,9 +120,6 @@ namespace GHelper
static async void CheckForUpdates() static async void CheckForUpdates()
{ {
var assembly = Assembly.GetExecutingAssembly().GetName().Version.ToString();
settingsForm.SetVersionLabel("Version: " + assembly);
try try
{ {
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
@@ -121,19 +131,21 @@ namespace GHelper
var url = config.GetProperty("assets")[0].GetProperty("browser_download_url").ToString(); var url = config.GetProperty("assets")[0].GetProperty("browser_download_url").ToString();
var gitVersion = new Version(tag); var gitVersion = new Version(tag);
var appVersion = new Version(assembly); var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString());
if (gitVersion.CompareTo(appVersion) > 0)
var result = gitVersion.CompareTo(appVersion);
if (result > 0)
{ {
settingsForm.SetVersionLabel("Download Update: " + tag, url); settingsForm.BeginInvoke(delegate
{
settingsForm.SetVersionLabel("Download Update: " + tag, url);
});
} }
} }
} }
catch catch (Exception ex)
{ {
Logger.WriteLine("Failed to get update"); Logger.WriteLine("Failed to check for updates:"+ ex.Message);
} }
} }
@@ -142,7 +154,7 @@ namespace GHelper
public static void SetAutoModes(bool wait = false) public static void SetAutoModes(bool wait = false)
{ {
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 1000) return; if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 2000) return;
lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds(); lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds();
PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus; PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;

100
app/Settings.Designer.cs generated
View File

@@ -68,11 +68,13 @@ namespace GHelper
buttonOptimized = new RButton(); buttonOptimized = new RButton();
buttonUltimate = new RButton(); buttonUltimate = new RButton();
panelScreen = new Panel(); panelScreen = new Panel();
labelMidFan = new Label();
labelTipScreen = new Label(); labelTipScreen = new Label();
tableScreen = new TableLayoutPanel(); tableScreen = new TableLayoutPanel();
buttonScreenAuto = new RButton(); buttonScreenAuto = new RButton();
button60Hz = new RButton(); button60Hz = new RButton();
button120Hz = new RButton(); button120Hz = new RButton();
buttonMiniled = new RButton();
pictureScreen = new PictureBox(); pictureScreen = new PictureBox();
labelSreen = new Label(); labelSreen = new Label();
panelKeyboard = new Panel(); panelKeyboard = new Panel();
@@ -85,7 +87,6 @@ namespace GHelper
buttonKeyboardColor = new RButton(); buttonKeyboardColor = new RButton();
pictureKeyboard = new PictureBox(); pictureKeyboard = new PictureBox();
labelKeyboard = new Label(); labelKeyboard = new Label();
buttonMiniled = new RButton();
panelMatrix.SuspendLayout(); panelMatrix.SuspendLayout();
tableLayoutMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
@@ -178,14 +179,16 @@ namespace GHelper
// buttonMatrix // buttonMatrix
// //
buttonMatrix.Activated = false; buttonMatrix.Activated = false;
buttonMatrix.BackColor = SystemColors.ControlLight; buttonMatrix.BackColor = Color.FromArgb(230, 230, 230);
buttonMatrix.BorderColor = Color.Transparent; buttonMatrix.BorderColor = Color.Transparent;
buttonMatrix.BorderRadius = 2;
buttonMatrix.Dock = DockStyle.Top; buttonMatrix.Dock = DockStyle.Top;
buttonMatrix.FlatAppearance.BorderSize = 0; buttonMatrix.FlatAppearance.BorderSize = 0;
buttonMatrix.FlatStyle = FlatStyle.Flat; buttonMatrix.FlatStyle = FlatStyle.Flat;
buttonMatrix.Location = new Point(390, 8); buttonMatrix.Location = new Point(390, 8);
buttonMatrix.Margin = new Padding(4, 8, 4, 8); buttonMatrix.Margin = new Padding(4, 8, 4, 8);
buttonMatrix.Name = "buttonMatrix"; buttonMatrix.Name = "buttonMatrix";
buttonMatrix.Secondary = true;
buttonMatrix.Size = new Size(185, 44); buttonMatrix.Size = new Size(185, 44);
buttonMatrix.TabIndex = 43; buttonMatrix.TabIndex = 43;
buttonMatrix.Text = "Picture / Gif"; buttonMatrix.Text = "Picture / Gif";
@@ -199,7 +202,7 @@ namespace GHelper
comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboMatrixRunning.FormattingEnabled = true; comboMatrixRunning.FormattingEnabled = true;
comboMatrixRunning.ItemHeight = 32; comboMatrixRunning.ItemHeight = 32;
comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture" }); comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture", "Clock" });
comboMatrixRunning.Location = new Point(197, 10); comboMatrixRunning.Location = new Point(197, 10);
comboMatrixRunning.Margin = new Padding(4, 10, 4, 8); comboMatrixRunning.Margin = new Padding(4, 10, 4, 8);
comboMatrixRunning.Name = "comboMatrixRunning"; comboMatrixRunning.Name = "comboMatrixRunning";
@@ -324,13 +327,15 @@ namespace GHelper
// //
buttonQuit.Activated = false; buttonQuit.Activated = false;
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonQuit.BackColor = SystemColors.ControlLight; buttonQuit.BackColor = Color.FromArgb(230, 230, 230);
buttonQuit.BorderColor = Color.Transparent; buttonQuit.BorderColor = Color.Transparent;
buttonQuit.BorderRadius = 2;
buttonQuit.FlatStyle = FlatStyle.Flat; buttonQuit.FlatStyle = FlatStyle.Flat;
buttonQuit.Location = new Point(578, 16); buttonQuit.Location = new Point(599, 16);
buttonQuit.Margin = new Padding(8, 4, 8, 4); buttonQuit.Margin = new Padding(8, 4, 8, 4);
buttonQuit.Name = "buttonQuit"; buttonQuit.Name = "buttonQuit";
buttonQuit.Size = new Size(208, 44); buttonQuit.Secondary = true;
buttonQuit.Size = new Size(185, 44);
buttonQuit.TabIndex = 18; buttonQuit.TabIndex = 18;
buttonQuit.Text = "Quit"; buttonQuit.Text = "Quit";
buttonQuit.UseVisualStyleBackColor = false; buttonQuit.UseVisualStyleBackColor = false;
@@ -388,6 +393,7 @@ namespace GHelper
// labelCPUFan // labelCPUFan
// //
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelCPUFan.Cursor = Cursors.Hand;
labelCPUFan.Location = new Point(384, 15); labelCPUFan.Location = new Point(384, 15);
labelCPUFan.Margin = new Padding(8, 0, 8, 0); labelCPUFan.Margin = new Padding(8, 0, 8, 0);
labelCPUFan.Name = "labelCPUFan"; labelCPUFan.Name = "labelCPUFan";
@@ -424,6 +430,7 @@ namespace GHelper
buttonSilent.BackColor = SystemColors.ControlLightLight; buttonSilent.BackColor = SystemColors.ControlLightLight;
buttonSilent.BackgroundImageLayout = ImageLayout.None; buttonSilent.BackgroundImageLayout = ImageLayout.None;
buttonSilent.BorderColor = Color.Transparent; buttonSilent.BorderColor = Color.Transparent;
buttonSilent.BorderRadius = 5;
buttonSilent.CausesValidation = false; buttonSilent.CausesValidation = false;
buttonSilent.Dock = DockStyle.Fill; buttonSilent.Dock = DockStyle.Fill;
buttonSilent.FlatAppearance.BorderSize = 0; buttonSilent.FlatAppearance.BorderSize = 0;
@@ -434,6 +441,7 @@ namespace GHelper
buttonSilent.Location = new Point(4, 4); buttonSilent.Location = new Point(4, 4);
buttonSilent.Margin = new Padding(4); buttonSilent.Margin = new Padding(4);
buttonSilent.Name = "buttonSilent"; buttonSilent.Name = "buttonSilent";
buttonSilent.Secondary = false;
buttonSilent.Size = new Size(185, 120); buttonSilent.Size = new Size(185, 120);
buttonSilent.TabIndex = 0; buttonSilent.TabIndex = 0;
buttonSilent.Text = "Silent"; buttonSilent.Text = "Silent";
@@ -445,6 +453,7 @@ namespace GHelper
buttonBalanced.Activated = false; buttonBalanced.Activated = false;
buttonBalanced.BackColor = SystemColors.ControlLightLight; buttonBalanced.BackColor = SystemColors.ControlLightLight;
buttonBalanced.BorderColor = Color.Transparent; buttonBalanced.BorderColor = Color.Transparent;
buttonBalanced.BorderRadius = 5;
buttonBalanced.Dock = DockStyle.Fill; buttonBalanced.Dock = DockStyle.Fill;
buttonBalanced.FlatAppearance.BorderSize = 0; buttonBalanced.FlatAppearance.BorderSize = 0;
buttonBalanced.FlatStyle = FlatStyle.Flat; buttonBalanced.FlatStyle = FlatStyle.Flat;
@@ -454,6 +463,7 @@ namespace GHelper
buttonBalanced.Location = new Point(197, 4); buttonBalanced.Location = new Point(197, 4);
buttonBalanced.Margin = new Padding(4); buttonBalanced.Margin = new Padding(4);
buttonBalanced.Name = "buttonBalanced"; buttonBalanced.Name = "buttonBalanced";
buttonBalanced.Secondary = false;
buttonBalanced.Size = new Size(185, 120); buttonBalanced.Size = new Size(185, 120);
buttonBalanced.TabIndex = 1; buttonBalanced.TabIndex = 1;
buttonBalanced.Text = "Balanced"; buttonBalanced.Text = "Balanced";
@@ -465,6 +475,7 @@ namespace GHelper
buttonTurbo.Activated = false; buttonTurbo.Activated = false;
buttonTurbo.BackColor = SystemColors.ControlLightLight; buttonTurbo.BackColor = SystemColors.ControlLightLight;
buttonTurbo.BorderColor = Color.Transparent; buttonTurbo.BorderColor = Color.Transparent;
buttonTurbo.BorderRadius = 5;
buttonTurbo.Dock = DockStyle.Fill; buttonTurbo.Dock = DockStyle.Fill;
buttonTurbo.FlatAppearance.BorderSize = 0; buttonTurbo.FlatAppearance.BorderSize = 0;
buttonTurbo.FlatStyle = FlatStyle.Flat; buttonTurbo.FlatStyle = FlatStyle.Flat;
@@ -474,6 +485,7 @@ namespace GHelper
buttonTurbo.Location = new Point(390, 4); buttonTurbo.Location = new Point(390, 4);
buttonTurbo.Margin = new Padding(4); buttonTurbo.Margin = new Padding(4);
buttonTurbo.Name = "buttonTurbo"; buttonTurbo.Name = "buttonTurbo";
buttonTurbo.Secondary = false;
buttonTurbo.Size = new Size(185, 120); buttonTurbo.Size = new Size(185, 120);
buttonTurbo.TabIndex = 2; buttonTurbo.TabIndex = 2;
buttonTurbo.Text = "Turbo"; buttonTurbo.Text = "Turbo";
@@ -483,8 +495,9 @@ namespace GHelper
// buttonFans // buttonFans
// //
buttonFans.Activated = false; buttonFans.Activated = false;
buttonFans.BackColor = SystemColors.ControlLight; buttonFans.BackColor = Color.FromArgb(230, 230, 230);
buttonFans.BorderColor = Color.Transparent; buttonFans.BorderColor = Color.Transparent;
buttonFans.BorderRadius = 5;
buttonFans.Dock = DockStyle.Fill; buttonFans.Dock = DockStyle.Fill;
buttonFans.FlatAppearance.BorderSize = 0; buttonFans.FlatAppearance.BorderSize = 0;
buttonFans.FlatStyle = FlatStyle.Flat; buttonFans.FlatStyle = FlatStyle.Flat;
@@ -493,6 +506,7 @@ namespace GHelper
buttonFans.Location = new Point(583, 4); buttonFans.Location = new Point(583, 4);
buttonFans.Margin = new Padding(4); buttonFans.Margin = new Padding(4);
buttonFans.Name = "buttonFans"; buttonFans.Name = "buttonFans";
buttonFans.Secondary = true;
buttonFans.Size = new Size(185, 120); buttonFans.Size = new Size(185, 120);
buttonFans.TabIndex = 35; buttonFans.TabIndex = 35;
buttonFans.Text = "Fans + Power"; buttonFans.Text = "Fans + Power";
@@ -586,6 +600,7 @@ namespace GHelper
buttonEco.Activated = false; buttonEco.Activated = false;
buttonEco.BackColor = SystemColors.ControlLightLight; buttonEco.BackColor = SystemColors.ControlLightLight;
buttonEco.BorderColor = Color.Transparent; buttonEco.BorderColor = Color.Transparent;
buttonEco.BorderRadius = 5;
buttonEco.CausesValidation = false; buttonEco.CausesValidation = false;
buttonEco.Dock = DockStyle.Top; buttonEco.Dock = DockStyle.Top;
buttonEco.FlatAppearance.BorderSize = 0; buttonEco.FlatAppearance.BorderSize = 0;
@@ -596,6 +611,7 @@ namespace GHelper
buttonEco.Location = new Point(4, 4); buttonEco.Location = new Point(4, 4);
buttonEco.Margin = new Padding(4); buttonEco.Margin = new Padding(4);
buttonEco.Name = "buttonEco"; buttonEco.Name = "buttonEco";
buttonEco.Secondary = false;
buttonEco.Size = new Size(185, 120); buttonEco.Size = new Size(185, 120);
buttonEco.TabIndex = 0; buttonEco.TabIndex = 0;
buttonEco.Text = "Eco"; buttonEco.Text = "Eco";
@@ -607,6 +623,7 @@ namespace GHelper
buttonStandard.Activated = false; buttonStandard.Activated = false;
buttonStandard.BackColor = SystemColors.ControlLightLight; buttonStandard.BackColor = SystemColors.ControlLightLight;
buttonStandard.BorderColor = Color.Transparent; buttonStandard.BorderColor = Color.Transparent;
buttonStandard.BorderRadius = 5;
buttonStandard.Dock = DockStyle.Top; buttonStandard.Dock = DockStyle.Top;
buttonStandard.FlatAppearance.BorderSize = 0; buttonStandard.FlatAppearance.BorderSize = 0;
buttonStandard.FlatStyle = FlatStyle.Flat; buttonStandard.FlatStyle = FlatStyle.Flat;
@@ -616,6 +633,7 @@ namespace GHelper
buttonStandard.Location = new Point(197, 4); buttonStandard.Location = new Point(197, 4);
buttonStandard.Margin = new Padding(4); buttonStandard.Margin = new Padding(4);
buttonStandard.Name = "buttonStandard"; buttonStandard.Name = "buttonStandard";
buttonStandard.Secondary = false;
buttonStandard.Size = new Size(185, 120); buttonStandard.Size = new Size(185, 120);
buttonStandard.TabIndex = 1; buttonStandard.TabIndex = 1;
buttonStandard.Text = "Standard"; buttonStandard.Text = "Standard";
@@ -627,6 +645,7 @@ namespace GHelper
buttonOptimized.Activated = false; buttonOptimized.Activated = false;
buttonOptimized.BackColor = SystemColors.ControlLightLight; buttonOptimized.BackColor = SystemColors.ControlLightLight;
buttonOptimized.BorderColor = Color.Transparent; buttonOptimized.BorderColor = Color.Transparent;
buttonOptimized.BorderRadius = 5;
buttonOptimized.Dock = DockStyle.Top; buttonOptimized.Dock = DockStyle.Top;
buttonOptimized.FlatAppearance.BorderSize = 0; buttonOptimized.FlatAppearance.BorderSize = 0;
buttonOptimized.FlatStyle = FlatStyle.Flat; buttonOptimized.FlatStyle = FlatStyle.Flat;
@@ -636,6 +655,7 @@ namespace GHelper
buttonOptimized.Location = new Point(583, 4); buttonOptimized.Location = new Point(583, 4);
buttonOptimized.Margin = new Padding(4); buttonOptimized.Margin = new Padding(4);
buttonOptimized.Name = "buttonOptimized"; buttonOptimized.Name = "buttonOptimized";
buttonOptimized.Secondary = false;
buttonOptimized.Size = new Size(185, 120); buttonOptimized.Size = new Size(185, 120);
buttonOptimized.TabIndex = 3; buttonOptimized.TabIndex = 3;
buttonOptimized.Text = "Optimized"; buttonOptimized.Text = "Optimized";
@@ -647,6 +667,7 @@ namespace GHelper
buttonUltimate.Activated = false; buttonUltimate.Activated = false;
buttonUltimate.BackColor = SystemColors.ControlLightLight; buttonUltimate.BackColor = SystemColors.ControlLightLight;
buttonUltimate.BorderColor = Color.Transparent; buttonUltimate.BorderColor = Color.Transparent;
buttonUltimate.BorderRadius = 5;
buttonUltimate.Dock = DockStyle.Top; buttonUltimate.Dock = DockStyle.Top;
buttonUltimate.FlatAppearance.BorderSize = 0; buttonUltimate.FlatAppearance.BorderSize = 0;
buttonUltimate.FlatStyle = FlatStyle.Flat; buttonUltimate.FlatStyle = FlatStyle.Flat;
@@ -656,6 +677,7 @@ namespace GHelper
buttonUltimate.Location = new Point(390, 4); buttonUltimate.Location = new Point(390, 4);
buttonUltimate.Margin = new Padding(4); buttonUltimate.Margin = new Padding(4);
buttonUltimate.Name = "buttonUltimate"; buttonUltimate.Name = "buttonUltimate";
buttonUltimate.Secondary = false;
buttonUltimate.Size = new Size(185, 120); buttonUltimate.Size = new Size(185, 120);
buttonUltimate.TabIndex = 2; buttonUltimate.TabIndex = 2;
buttonUltimate.Text = "Ultimate"; buttonUltimate.Text = "Ultimate";
@@ -666,6 +688,7 @@ namespace GHelper
// //
panelScreen.AutoSize = true; panelScreen.AutoSize = true;
panelScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelScreen.Controls.Add(labelMidFan);
panelScreen.Controls.Add(labelTipScreen); panelScreen.Controls.Add(labelTipScreen);
panelScreen.Controls.Add(tableScreen); panelScreen.Controls.Add(tableScreen);
panelScreen.Controls.Add(pictureScreen); panelScreen.Controls.Add(pictureScreen);
@@ -678,6 +701,17 @@ namespace GHelper
panelScreen.Size = new Size(810, 181); panelScreen.Size = new Size(810, 181);
panelScreen.TabIndex = 38; panelScreen.TabIndex = 38;
// //
// labelMidFan
//
labelMidFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelMidFan.Location = new Point(488, 13);
labelMidFan.Margin = new Padding(8, 0, 8, 0);
labelMidFan.Name = "labelMidFan";
labelMidFan.Size = new Size(296, 34);
labelMidFan.TabIndex = 25;
labelMidFan.Text = " ";
labelMidFan.TextAlign = ContentAlignment.TopRight;
//
// labelTipScreen // labelTipScreen
// //
labelTipScreen.ForeColor = SystemColors.GrayText; labelTipScreen.ForeColor = SystemColors.GrayText;
@@ -700,6 +734,7 @@ namespace GHelper
tableScreen.Controls.Add(buttonScreenAuto, 0, 0); tableScreen.Controls.Add(buttonScreenAuto, 0, 0);
tableScreen.Controls.Add(button60Hz, 1, 0); tableScreen.Controls.Add(button60Hz, 1, 0);
tableScreen.Controls.Add(button120Hz, 2, 0); tableScreen.Controls.Add(button120Hz, 2, 0);
tableScreen.Controls.Add(buttonMiniled, 3, 0);
tableScreen.Location = new Point(16, 51); tableScreen.Location = new Point(16, 51);
tableScreen.Margin = new Padding(8, 4, 8, 4); tableScreen.Margin = new Padding(8, 4, 8, 4);
tableScreen.Name = "tableScreen"; tableScreen.Name = "tableScreen";
@@ -713,6 +748,7 @@ namespace GHelper
buttonScreenAuto.Activated = false; buttonScreenAuto.Activated = false;
buttonScreenAuto.BackColor = SystemColors.ControlLightLight; buttonScreenAuto.BackColor = SystemColors.ControlLightLight;
buttonScreenAuto.BorderColor = Color.Transparent; buttonScreenAuto.BorderColor = Color.Transparent;
buttonScreenAuto.BorderRadius = 5;
buttonScreenAuto.Dock = DockStyle.Fill; buttonScreenAuto.Dock = DockStyle.Fill;
buttonScreenAuto.FlatAppearance.BorderSize = 0; buttonScreenAuto.FlatAppearance.BorderSize = 0;
buttonScreenAuto.FlatStyle = FlatStyle.Flat; buttonScreenAuto.FlatStyle = FlatStyle.Flat;
@@ -720,6 +756,7 @@ namespace GHelper
buttonScreenAuto.Location = new Point(4, 4); buttonScreenAuto.Location = new Point(4, 4);
buttonScreenAuto.Margin = new Padding(4); buttonScreenAuto.Margin = new Padding(4);
buttonScreenAuto.Name = "buttonScreenAuto"; buttonScreenAuto.Name = "buttonScreenAuto";
buttonScreenAuto.Secondary = false;
buttonScreenAuto.Size = new Size(185, 72); buttonScreenAuto.Size = new Size(185, 72);
buttonScreenAuto.TabIndex = 0; buttonScreenAuto.TabIndex = 0;
buttonScreenAuto.Text = "Auto"; buttonScreenAuto.Text = "Auto";
@@ -730,6 +767,7 @@ namespace GHelper
button60Hz.Activated = false; button60Hz.Activated = false;
button60Hz.BackColor = SystemColors.ControlLightLight; button60Hz.BackColor = SystemColors.ControlLightLight;
button60Hz.BorderColor = Color.Transparent; button60Hz.BorderColor = Color.Transparent;
button60Hz.BorderRadius = 5;
button60Hz.CausesValidation = false; button60Hz.CausesValidation = false;
button60Hz.Dock = DockStyle.Fill; button60Hz.Dock = DockStyle.Fill;
button60Hz.FlatAppearance.BorderSize = 0; button60Hz.FlatAppearance.BorderSize = 0;
@@ -738,6 +776,7 @@ namespace GHelper
button60Hz.Location = new Point(197, 4); button60Hz.Location = new Point(197, 4);
button60Hz.Margin = new Padding(4); button60Hz.Margin = new Padding(4);
button60Hz.Name = "button60Hz"; button60Hz.Name = "button60Hz";
button60Hz.Secondary = false;
button60Hz.Size = new Size(185, 72); button60Hz.Size = new Size(185, 72);
button60Hz.TabIndex = 1; button60Hz.TabIndex = 1;
button60Hz.Text = "60Hz"; button60Hz.Text = "60Hz";
@@ -748,6 +787,7 @@ namespace GHelper
button120Hz.Activated = false; button120Hz.Activated = false;
button120Hz.BackColor = SystemColors.ControlLightLight; button120Hz.BackColor = SystemColors.ControlLightLight;
button120Hz.BorderColor = Color.Transparent; button120Hz.BorderColor = Color.Transparent;
button120Hz.BorderRadius = 5;
button120Hz.Dock = DockStyle.Fill; button120Hz.Dock = DockStyle.Fill;
button120Hz.FlatAppearance.BorderSize = 0; button120Hz.FlatAppearance.BorderSize = 0;
button120Hz.FlatStyle = FlatStyle.Flat; button120Hz.FlatStyle = FlatStyle.Flat;
@@ -755,11 +795,32 @@ namespace GHelper
button120Hz.Location = new Point(390, 4); button120Hz.Location = new Point(390, 4);
button120Hz.Margin = new Padding(4); button120Hz.Margin = new Padding(4);
button120Hz.Name = "button120Hz"; button120Hz.Name = "button120Hz";
button120Hz.Secondary = false;
button120Hz.Size = new Size(185, 72); button120Hz.Size = new Size(185, 72);
button120Hz.TabIndex = 2; button120Hz.TabIndex = 2;
button120Hz.Text = "120Hz + OD"; button120Hz.Text = "120Hz + OD";
button120Hz.UseVisualStyleBackColor = false; button120Hz.UseVisualStyleBackColor = false;
// //
// buttonMiniled
//
buttonMiniled.Activated = false;
buttonMiniled.BackColor = SystemColors.ControlLightLight;
buttonMiniled.BorderColor = Color.Transparent;
buttonMiniled.BorderRadius = 5;
buttonMiniled.CausesValidation = false;
buttonMiniled.Dock = DockStyle.Fill;
buttonMiniled.FlatAppearance.BorderSize = 0;
buttonMiniled.FlatStyle = FlatStyle.Flat;
buttonMiniled.ForeColor = SystemColors.ControlText;
buttonMiniled.Location = new Point(583, 4);
buttonMiniled.Margin = new Padding(4);
buttonMiniled.Name = "buttonMiniled";
buttonMiniled.Secondary = false;
buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled";
buttonMiniled.UseVisualStyleBackColor = false;
//
// pictureScreen // pictureScreen
// //
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage"); pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
@@ -821,14 +882,16 @@ namespace GHelper
// buttonKeyboard // buttonKeyboard
// //
buttonKeyboard.Activated = false; buttonKeyboard.Activated = false;
buttonKeyboard.BackColor = SystemColors.ControlLight; buttonKeyboard.BackColor = Color.FromArgb(230, 230, 230);
buttonKeyboard.BorderColor = Color.Transparent; buttonKeyboard.BorderColor = Color.Transparent;
buttonKeyboard.BorderRadius = 2;
buttonKeyboard.Dock = DockStyle.Top; buttonKeyboard.Dock = DockStyle.Top;
buttonKeyboard.FlatAppearance.BorderSize = 0; buttonKeyboard.FlatAppearance.BorderSize = 0;
buttonKeyboard.FlatStyle = FlatStyle.Flat; buttonKeyboard.FlatStyle = FlatStyle.Flat;
buttonKeyboard.Location = new Point(390, 8); buttonKeyboard.Location = new Point(390, 8);
buttonKeyboard.Margin = new Padding(4, 8, 4, 8); buttonKeyboard.Margin = new Padding(4, 8, 4, 8);
buttonKeyboard.Name = "buttonKeyboard"; buttonKeyboard.Name = "buttonKeyboard";
buttonKeyboard.Secondary = true;
buttonKeyboard.Size = new Size(185, 44); buttonKeyboard.Size = new Size(185, 44);
buttonKeyboard.TabIndex = 37; buttonKeyboard.TabIndex = 37;
buttonKeyboard.Text = "Extra"; buttonKeyboard.Text = "Extra";
@@ -889,12 +952,14 @@ namespace GHelper
buttonKeyboardColor.Activated = false; buttonKeyboardColor.Activated = false;
buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight; buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight;
buttonKeyboardColor.BorderColor = Color.Transparent; buttonKeyboardColor.BorderColor = Color.Transparent;
buttonKeyboardColor.BorderRadius = 2;
buttonKeyboardColor.Dock = DockStyle.Top; buttonKeyboardColor.Dock = DockStyle.Top;
buttonKeyboardColor.FlatStyle = FlatStyle.Flat; buttonKeyboardColor.FlatStyle = FlatStyle.Flat;
buttonKeyboardColor.ForeColor = SystemColors.ControlText; buttonKeyboardColor.ForeColor = SystemColors.ControlText;
buttonKeyboardColor.Location = new Point(0, 0); buttonKeyboardColor.Location = new Point(0, 0);
buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8); buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8);
buttonKeyboardColor.Name = "buttonKeyboardColor"; buttonKeyboardColor.Name = "buttonKeyboardColor";
buttonKeyboardColor.Secondary = false;
buttonKeyboardColor.Size = new Size(185, 44); buttonKeyboardColor.Size = new Size(185, 44);
buttonKeyboardColor.TabIndex = 39; buttonKeyboardColor.TabIndex = 39;
buttonKeyboardColor.Text = "Color "; buttonKeyboardColor.Text = "Color ";
@@ -922,24 +987,6 @@ namespace GHelper
labelKeyboard.TabIndex = 32; labelKeyboard.TabIndex = 32;
labelKeyboard.Text = "Laptop Keyboard"; labelKeyboard.Text = "Laptop Keyboard";
// //
// buttonMiniled
//
buttonMiniled.Activated = false;
buttonMiniled.BackColor = SystemColors.ControlLightLight;
buttonMiniled.BorderColor = Color.Transparent;
buttonMiniled.CausesValidation = false;
buttonMiniled.Dock = DockStyle.Fill;
buttonMiniled.FlatAppearance.BorderSize = 0;
buttonMiniled.FlatStyle = FlatStyle.Flat;
buttonMiniled.ForeColor = SystemColors.ControlText;
buttonMiniled.Location = new Point(197, 4);
buttonMiniled.Margin = new Padding(4);
buttonMiniled.Name = "buttonMiniled";
buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled";
buttonMiniled.UseVisualStyleBackColor = false;
//
// SettingsForm // SettingsForm
// //
AutoScaleDimensions = new SizeF(192F, 192F); AutoScaleDimensions = new SizeF(192F, 192F);
@@ -1055,5 +1102,6 @@ namespace GHelper
private RButton buttonKeyboard; private RButton buttonKeyboard;
private RButton buttonKeyboardColor; private RButton buttonKeyboardColor;
private RButton buttonFans; private RButton buttonFans;
private Label labelMidFan;
} }
} }

View File

@@ -10,7 +10,9 @@ namespace GHelper
public partial class SettingsForm : RForm public partial class SettingsForm : RForm
{ {
static System.Timers.Timer aTimer = default!; public static System.Timers.Timer aTimer = default!;
public static Point trayPoint;
static System.Timers.Timer matrixTimer = default!; static System.Timers.Timer matrixTimer = default!;
public string versionUrl = "http://github.com/seerge/g-helper/releases"; public string versionUrl = "http://github.com/seerge/g-helper/releases";
@@ -21,6 +23,7 @@ namespace GHelper
public Keyboard keyb; public Keyboard keyb;
static AnimeMatrixDevice mat; static AnimeMatrixDevice mat;
static long lastTip;
public SettingsForm() public SettingsForm()
{ {
@@ -114,12 +117,29 @@ namespace GHelper
button120Hz.MouseMove += Button120Hz_MouseHover; button120Hz.MouseMove += Button120Hz_MouseHover;
button120Hz.MouseLeave += ButtonScreen_MouseLeave; button120Hz.MouseLeave += ButtonScreen_MouseLeave;
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16))); //buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
SetTimer(); aTimer = new System.Timers.Timer(500);
aTimer.Elapsed += OnTimedEvent;
} }
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
{
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTip) < 2000) return;
lastTip = DateTimeOffset.Now.ToUnixTimeMilliseconds();
RefreshSensors();
}
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
aTimer.Interval = 2000;
if (Program.settingsForm.Visible)
RefreshSensors();
}
private void Button120Hz_MouseHover(object? sender, EventArgs e) private void Button120Hz_MouseHover(object? sender, EventArgs e)
{ {
@@ -252,8 +272,9 @@ namespace GHelper
Program.config.setConfig("matrix_auto", check.Checked ? 1 : 0); Program.config.setConfig("matrix_auto", check.Checked ? 1 : 0);
} }
private static void StartMatrixTimer() private static void StartMatrixTimer(int interval = 100)
{ {
matrixTimer.Interval = interval;
matrixTimer.Enabled = true; matrixTimer.Enabled = true;
} }
@@ -265,14 +286,23 @@ namespace GHelper
private static void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e) private static void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e)
{ {
if (mat is null) return; if (mat is null) return;
mat.PresentNextFrame();
switch (Program.config.getConfig("matrix_running"))
{
case 2:
mat.PresentNextFrame();
break;
case 3:
mat.PresentText(DateTime.Now.ToString("H:mm:ss"));
break;
}
} }
void SetMatrixPicture(string fileName) void SetMatrixPicture(string fileName)
{ {
if (mat is null) return; if (mat is null) return;
StopMatrixTimer(); StopMatrixTimer();
Image image; Image image;
@@ -315,8 +345,6 @@ namespace GHelper
mat.GenerateFrame(image); mat.GenerateFrame(image);
mat.Present(); mat.Present();
} }
} }
@@ -342,6 +370,8 @@ namespace GHelper
if (fileName is not null) if (fileName is not null)
{ {
Program.config.setConfig("matrix_picture", fileName); Program.config.setConfig("matrix_picture", fileName);
Program.config.setConfig("matrix_running", 2);
SetMatrixPicture(fileName); SetMatrixPicture(fileName);
BeginInvoke(delegate BeginInvoke(delegate
{ {
@@ -397,16 +427,22 @@ namespace GHelper
mat.SetDisplayState(true); mat.SetDisplayState(true);
mat.SetBrightness((BrightnessMode)brightness); mat.SetBrightness((BrightnessMode)brightness);
if (running == 2) switch (running)
{ {
string fileName = Program.config.getConfigString("matrix_picture"); case 2:
SetMatrixPicture(fileName); SetMatrixPicture(Program.config.getConfigString("matrix_picture"));
} break;
else case 3:
{ mat.SetBuiltInAnimation(false);
mat.SetBuiltInAnimation(true, animation); StartMatrixTimer(1000);
break;
default:
mat.SetBuiltInAnimation(true, animation);
break;
} }
//mat.SetBrightness((BrightnessMode)brightness);
} }
} }
@@ -532,8 +568,8 @@ namespace GHelper
int brightness = Program.config.getConfig("matrix_brightness"); int brightness = Program.config.getConfig("matrix_brightness");
int running = Program.config.getConfig("matrix_running"); int running = Program.config.getConfig("matrix_running");
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0; comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count - 1) : 0;
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0; comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0;
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1); checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
@@ -705,10 +741,13 @@ namespace GHelper
if (miniled >= 0) if (miniled >= 0)
{ {
tableScreen.Controls.Add(buttonMiniled, 3, 0);
buttonMiniled.Activated = (miniled == 1); buttonMiniled.Activated = (miniled == 1);
Program.config.setConfig("miniled", miniled); Program.config.setConfig("miniled", miniled);
} }
else
{
buttonMiniled.Visible = false;
}
Program.config.setConfig("frequency", frequency); Program.config.setConfig("frequency", frequency);
Program.config.setConfig("overdrive", overdrive); Program.config.setConfig("overdrive", overdrive);
@@ -745,17 +784,11 @@ namespace GHelper
SetGPUMode(ASUSWmi.GPUModeEco); SetGPUMode(ASUSWmi.GPUModeEco);
} }
private static void SetTimer()
{
aTimer = new System.Timers.Timer(500);
aTimer.Elapsed += OnTimedEvent;
aTimer.AutoReset = true;
aTimer.Enabled = false;
}
private static string FormatFan(int fan) private static string FormatFan(int fan)
{ {
if (fan < 0) return null;
if (Program.config.getConfig("fan_rpm") == 1) if (Program.config.getConfig("fan_rpm") == 1)
return " Fan: " + (fan * 100).ToString() + "RPM"; return " Fan: " + (fan * 100).ToString() + "RPM";
else else
@@ -767,6 +800,7 @@ namespace GHelper
string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan)); string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan)); string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
string midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
string cpuTemp = ""; string cpuTemp = "";
string gpuTemp = ""; string gpuTemp = "";
@@ -789,15 +823,14 @@ namespace GHelper
{ {
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan; Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan; Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
if (midFan is not null) Program.settingsForm.labelMidFan.Text = "Mid" + midFan;
Program.settingsForm.labelBattery.Text = battery; Program.settingsForm.labelBattery.Text = battery;
Program.trayIcon.Text = "CPU" + cpuTemp + cpuFan + "\n" + "GPU" + gpuTemp + gpuFan + ((battery.Length > 0) ? ("\n" + battery) : "");
}); });
} }
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
RefreshSensors();
aTimer.Interval = 2000;
}
private void SettingsForm_VisibleChanged(object? sender, EventArgs e) private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
{ {
@@ -850,6 +883,9 @@ namespace GHelper
{ {
Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0)); Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1)); Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
if (Program.config.getConfig("mid_fan") == 1)
Program.wmi.SetFanCurve(2, Program.config.getFanConfig(2));
} }
if (Program.config.getConfigPerf("auto_apply_power") == 1) if (Program.config.getConfigPerf("auto_apply_power") == 1)
@@ -991,12 +1027,6 @@ namespace GHelper
if (!ultimate) if (!ultimate)
{ {
tableGPU.Controls.Remove(buttonUltimate); tableGPU.Controls.Remove(buttonUltimate);
/*
* buttonFans.Image = null;
buttonFans.Height = 44;
*/
tablePerf.ColumnCount = 0; tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0; tableGPU.ColumnCount = 0;
tableScreen.ColumnCount = 0; tableScreen.ColumnCount = 0;

View File

@@ -53,14 +53,14 @@ PPTs are shown for G14 2022, for other models PPTs will be different as they are
### :video_game: GPU Modes ### :video_game: GPU Modes
1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display 1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display
2. Standard mode (Windows Hybrid) : iGPU and dGPU enabled, iGPU drives built in display 2. Standard mode (MS Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model) 3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model)
4. Optimized (formely existed as a checkbox): disables dGPU on battery (Eco) and enables when plugged (Standard) 4. Optimized (formely existed as a checkbox): disables dGPU on battery (Eco) and enables when plugged (Standard)
### :question: FAQ ### :question: FAQ
#### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key? #### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
Go to BIOS (F2 on boot), open Advanced Settings (F8) and disable "Armory Control Intrerface" Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Intrerface"
#### Why Ultimate GPU mode is not available on my laptop? #### Why Ultimate GPU mode is not available on my laptop?
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+) Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
@@ -68,6 +68,9 @@ Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other mo
#### App doesn't start / or crashes, what should I do ? #### App doesn't start / or crashes, what should I do ?
Open "Event Viewer" from start menu, go to Windows Logs -> Application and check for recent Errors mentioning G-Helper. If you see one - please post a [new issue](https://github.com/seerge/g-helper/issues) with all details from this error. Open "Event Viewer" from start menu, go to Windows Logs -> Application and check for recent Errors mentioning G-Helper. If you see one - please post a [new issue](https://github.com/seerge/g-helper/issues) with all details from this error.
#### How do I uninstall G-helper?
G-helper is a single exe, and it doesn't install anything in the system. To remove it - you can simply delete exe :) If you have applied any custom fan profiles or PPTs - before removing I would recommend selecting your favorite perfromance mode (for example balanced) and clicking "Factory defaults" under Fans + Power.
---------------------------- ----------------------------
### How to install ### How to install

BIN
docs/screenshot-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB