Minor tweaks

This commit is contained in:
seerge
2023-03-27 14:28:28 +02:00
parent 7ab3b450cd
commit 089b339e61
8 changed files with 187 additions and 89 deletions

View File

@@ -2,6 +2,7 @@
using Starlight.AnimeMatrix;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.Globalization;
using System.Reflection;
using System.Text.Json;
using System.Timers;
@@ -133,6 +134,8 @@ namespace GHelper
labelModel.Text = model;
this.TopMost = Program.config.getConfig("topmost") == 1;
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(5));
@@ -687,8 +690,7 @@ namespace GHelper
if (frequency >= 1000)
{
frequency = Program.config.getConfig("max_frequency");
if (frequency <= 60) frequency = 120;
frequency = NativeMethods.GetRefreshRate(true);
}
if (frequency > 0)
@@ -714,7 +716,7 @@ namespace GHelper
{
int frequency = NativeMethods.GetRefreshRate();
int maxFrequency = Program.config.getConfig("max_frequency");
int maxFrequency = NativeMethods.GetRefreshRate(true);
bool screenAuto = (Program.config.getConfig("screen_auto") == 1);
@@ -744,12 +746,8 @@ namespace GHelper
{
button60Hz.Activated = true;
}
else
else if (frequency > 60)
{
if (frequency > 60)
maxFrequency = frequency;
Program.config.setConfig("max_frequency", maxFrequency);
button120Hz.Activated = true;
}
@@ -999,6 +997,19 @@ namespace GHelper
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
}
public void AutoKeyboard(PowerLineStatus Plugged = PowerLineStatus.Online)
{
if (Program.config.getConfig("keyboard_auto") != 1) return;
if (Plugged == PowerLineStatus.Online)
Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Up);
else
Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Down);
}
public void AutoPerformance(PowerLineStatus Plugged = PowerLineStatus.Online)
{
int mode = Program.config.getConfig("performance_" + (int)Plugged);