mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77d89505b3 | ||
|
|
4be790dce0 | ||
|
|
c9698a1613 | ||
|
|
819506e7ee | ||
|
|
489616d255 | ||
|
|
1103ab70f6 | ||
|
|
dbf0cbc3ac | ||
|
|
a45d693937 | ||
|
|
0db49af310 | ||
|
|
28daaf9a4c | ||
|
|
38d02ee7f9 | ||
|
|
c6d1b29a49 | ||
|
|
79cd773632 | ||
|
|
897de4ed27 | ||
|
|
afa6dbb542 | ||
|
|
80fbee2609 | ||
|
|
e1c83da19b | ||
|
|
59b5888632 | ||
|
|
cd74c62908 | ||
|
|
000fbe466f |
@@ -111,8 +111,6 @@ namespace GHelper.AnimeMatrix
|
|||||||
deviceSlash.SetEnabled(true);
|
deviceSlash.SetEnabled(true);
|
||||||
deviceSlash.Init();
|
deviceSlash.Init();
|
||||||
|
|
||||||
deviceSlash.SetLidMode(false);
|
|
||||||
|
|
||||||
switch ((SlashMode)running)
|
switch ((SlashMode)running)
|
||||||
{
|
{
|
||||||
case SlashMode.Static:
|
case SlashMode.Static:
|
||||||
@@ -150,6 +148,11 @@ namespace GHelper.AnimeMatrix
|
|||||||
{
|
{
|
||||||
bool matrixLid = AppConfig.Is("matrix_lid");
|
bool matrixLid = AppConfig.Is("matrix_lid");
|
||||||
|
|
||||||
|
if (deviceSlash is not null)
|
||||||
|
{
|
||||||
|
deviceSlash.SetLidMode(!matrixLid && AppConfig.Is("slash_sleep"));
|
||||||
|
}
|
||||||
|
|
||||||
if (matrixLid || force)
|
if (matrixLid || force)
|
||||||
{
|
{
|
||||||
Logger.WriteLine($"Matrix LidClosed: {lidClose}");
|
Logger.WriteLine($"Matrix LidClosed: {lidClose}");
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void SetLidMode(bool status)
|
public void SetLidMode(bool status)
|
||||||
{
|
{
|
||||||
Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"DisableLidClose {status}");
|
Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"SlashLidCloseAnimation {status}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSleepActive(bool status)
|
public void SetSleepActive(bool status)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public static class AppConfig
|
|||||||
private static string? _bios;
|
private static string? _bios;
|
||||||
|
|
||||||
private static Dictionary<string, object> config = new Dictionary<string, object>();
|
private static Dictionary<string, object> config = new Dictionary<string, object>();
|
||||||
private static System.Timers.Timer timer = new System.Timers.Timer(1000);
|
private static System.Timers.Timer timer = new System.Timers.Timer(2000);
|
||||||
|
|
||||||
static AppConfig()
|
static AppConfig()
|
||||||
{
|
{
|
||||||
@@ -92,7 +92,9 @@ public static class AppConfig
|
|||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
|
||||||
if (File.ReadAllText(backup).Contains("}"))
|
var backupText = File.ReadAllText(backup);
|
||||||
|
|
||||||
|
if (backupText.Contains("{") && backupText.Contains("}"))
|
||||||
{
|
{
|
||||||
File.Copy(backup, configFile, true);
|
File.Copy(backup, configFile, true);
|
||||||
}
|
}
|
||||||
@@ -219,6 +221,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
private static void Write()
|
private static void Write()
|
||||||
{
|
{
|
||||||
|
timer.Stop();
|
||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,27 +305,32 @@ public static class AppConfig
|
|||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case AsusACPI.PerformanceTurbo:
|
||||||
if (device == AsusFan.GPU)
|
switch (device)
|
||||||
curve = StringToBytes("14-3F-44-48-4C-50-54-62-16-1F-26-2D-39-47-55-5F");
|
{
|
||||||
else
|
case AsusFan.GPU:
|
||||||
curve = StringToBytes("14-3F-44-48-4C-50-54-62-11-1A-22-29-34-43-51-5A");
|
return StringToBytes("14-3F-44-48-4C-50-54-62-16-1F-26-2D-39-47-55-5F");
|
||||||
break;
|
default:
|
||||||
case 2:
|
return StringToBytes("14-3F-44-48-4C-50-54-62-11-1A-22-29-34-43-51-5A");
|
||||||
if (device == AsusFan.GPU)
|
}
|
||||||
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-08-11-11-1D-1D-26-26-2D");
|
case AsusACPI.PerformanceSilent:
|
||||||
else
|
switch (device)
|
||||||
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-03-0C-0C-16-16-22-22-29");
|
{
|
||||||
break;
|
case AsusFan.GPU:
|
||||||
|
return StringToBytes("3C-41-42-46-47-4B-4C-62-08-11-11-1D-1D-26-26-2D");
|
||||||
|
default:
|
||||||
|
return StringToBytes("3C-41-42-46-47-4B-4C-62-03-0C-0C-16-16-22-22-29");
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if (device == AsusFan.GPU)
|
switch (device)
|
||||||
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-0C-16-1D-1F-26-2D-34-4A");
|
{
|
||||||
else
|
case AsusFan.GPU:
|
||||||
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-08-11-16-1A-22-29-30-45");
|
return StringToBytes("3A-3D-40-44-48-4D-51-62-0C-16-1D-1F-26-2D-34-4A");
|
||||||
break;
|
default:
|
||||||
|
return StringToBytes("3A-3D-40-44-48-4D-51-62-08-11-16-1A-22-29-30-45");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return curve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetModeString(string name)
|
public static string GetModeString(string name)
|
||||||
@@ -632,7 +640,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsForceSetGPUMode()
|
public static bool IsForceSetGPUMode()
|
||||||
{
|
{
|
||||||
return Is("gpu_mode_force_set") || ContainsModel("503");
|
return Is("gpu_mode_force_set") || (ContainsModel("503") && IsNotFalse("gpu_mode_force_set"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsNoGPUModes()
|
public static bool IsNoGPUModes()
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace GHelper.AutoUpdate
|
|||||||
Logger.WriteLine(ex.Message);
|
Logger.WriteLine(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.Exit(0);
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace GHelper.Display
|
|||||||
|
|
||||||
private static int _brightness = 100;
|
private static int _brightness = 100;
|
||||||
private static bool _init = true;
|
private static bool _init = true;
|
||||||
|
private static bool _download = true;
|
||||||
private static string? _splendidPath = null;
|
private static string? _splendidPath = null;
|
||||||
|
|
||||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(200);
|
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(200);
|
||||||
@@ -217,6 +218,11 @@ namespace GHelper.Display
|
|||||||
{
|
{
|
||||||
Logger.WriteLine("Gamut setting refused, reverting.");
|
Logger.WriteLine("Gamut setting refused, reverting.");
|
||||||
RunSplendid(SplendidCommand.GamutMode, 0, (int)GetDefaultGamut());
|
RunSplendid(SplendidCommand.GamutMode, 0, (int)GetDefaultGamut());
|
||||||
|
if (ProcessHelper.IsUserAdministrator() && _download)
|
||||||
|
{
|
||||||
|
_download = false;
|
||||||
|
ColorProfileHelper.InstallProfile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result == 1 && _init)
|
if (result == 1 && _init)
|
||||||
{
|
{
|
||||||
@@ -262,8 +268,13 @@ namespace GHelper.Display
|
|||||||
if (result == 0) return;
|
if (result == 0) return;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Visual setting refused, reverting.");
|
Logger.WriteLine("Visual mode setting refused, reverting.");
|
||||||
RunSplendid(SplendidCommand.Default, 0, DefaultColorTemp);
|
RunSplendid(SplendidCommand.Default, 0, DefaultColorTemp);
|
||||||
|
if (ProcessHelper.IsUserAdministrator() && _download)
|
||||||
|
{
|
||||||
|
_download = false;
|
||||||
|
ColorProfileHelper.InstallProfile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result == 1 && _init)
|
if (result == 1 && _init)
|
||||||
{
|
{
|
||||||
@@ -356,7 +367,7 @@ namespace GHelper.Display
|
|||||||
public static int SetBrightness(int brightness = -1, int delta = 0)
|
public static int SetBrightness(int brightness = -1, int delta = 0)
|
||||||
{
|
{
|
||||||
if (!AppConfig.IsOLED()) return -1;
|
if (!AppConfig.IsOLED()) return -1;
|
||||||
if (brightness < 0) GetBrightness();
|
if (brightness < 0) brightness = GetBrightness();
|
||||||
|
|
||||||
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
||||||
AppConfig.Set(IsOnBattery() ? "brightness_battery" : "brightness", _brightness);
|
AppConfig.Set(IsOnBattery() ? "brightness_battery" : "brightness", _brightness);
|
||||||
|
|||||||
@@ -505,7 +505,10 @@ namespace GHelper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
eCoresMax = Math.Max(8, eCoresMax);
|
if (eCoresMax == 0) eCoresMax = 8;
|
||||||
|
if (pCoresMax == 0) pCoresMax = 6;
|
||||||
|
|
||||||
|
eCoresMax = Math.Max(4, eCoresMax);
|
||||||
pCoresMax = Math.Max(6, pCoresMax);
|
pCoresMax = Math.Max(6, pCoresMax);
|
||||||
|
|
||||||
panelCores.Visible = true;
|
panelCores.Visible = true;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.191</AssemblyVersion>
|
<AssemblyVersion>0.194</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
<PackageReference Include="NAudio" Version="2.1.0" />
|
<PackageReference Include="NAudio" Version="2.1.0" />
|
||||||
<PackageReference Include="NvAPIWrapper.Net" Version="0.8.1.101" />
|
<PackageReference Include="NvAPIWrapper.Net" Version="0.8.1.101" />
|
||||||
<PackageReference Include="System.Management" Version="8.0.0" />
|
<PackageReference Include="System.Management" Version="8.0.0" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
||||||
<PackageReference Include="WinForms.DataVisualization" Version="1.8.0" />
|
<PackageReference Include="WinForms.DataVisualization" Version="1.9.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -92,13 +92,16 @@ namespace GHelper.Gpu
|
|||||||
{
|
{
|
||||||
if (AppConfig.NoAutoUltimate())
|
if (AppConfig.NoAutoUltimate())
|
||||||
{
|
{
|
||||||
int standardStatus = Program.acpi.SetGPUEco(0);
|
Program.acpi.SetGPUEco(0);
|
||||||
if (standardStatus == 0)
|
Thread.Sleep(500);
|
||||||
|
|
||||||
|
int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco);
|
||||||
|
Logger.WriteLine("Eco flag : " + eco);
|
||||||
|
if (eco == 1)
|
||||||
{
|
{
|
||||||
settings.VisualiseGPUMode();
|
settings.VisualiseGPUMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Thread.Sleep(100);
|
|
||||||
}
|
}
|
||||||
status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 0, "GPUMux");
|
status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 0, "GPUMux");
|
||||||
restart = true;
|
restart = true;
|
||||||
|
|||||||
@@ -2,21 +2,31 @@
|
|||||||
|
|
||||||
public static class TouchscreenHelper
|
public static class TouchscreenHelper
|
||||||
{
|
{
|
||||||
public static bool? ToggleTouchscreen()
|
|
||||||
|
public static bool? GetStatus()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProcessHelper.RunAsAdmin();
|
ProcessHelper.RunAsAdmin();
|
||||||
|
return ProcessHelper.RunCMD("powershell", "(Get-PnpDevice -FriendlyName '*touch*screen*').Status").Contains("OK");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine($"Can't get touchscreen status: {ex.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var status = !ProcessHelper.RunCMD("powershell", "(Get-PnpDevice -FriendlyName '*touch*screen*').Status").Contains("OK");
|
public static void ToggleTouchscreen(bool status)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProcessHelper.RunAsAdmin();
|
||||||
ProcessHelper.RunCMD("powershell", (status ? "Enable-PnpDevice" : "Disable-PnpDevice") + " -InstanceId (Get-PnpDevice -FriendlyName '*touch*screen*').InstanceId -Confirm:$false");
|
ProcessHelper.RunCMD("powershell", (status ? "Enable-PnpDevice" : "Disable-PnpDevice") + " -InstanceId (Get-PnpDevice -FriendlyName '*touch*screen*').InstanceId -Confirm:$false");
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine($"Can't toggle touchscreen: {ex.Message}");
|
Logger.WriteLine($"Can't toggle touchscreen: {ex.Message}");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -591,9 +591,13 @@ namespace GHelper.Input
|
|||||||
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
|
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
|
||||||
break;
|
break;
|
||||||
case "touchscreen":
|
case "touchscreen":
|
||||||
var touchscreenStatus = TouchscreenHelper.ToggleTouchscreen();
|
var status = !TouchscreenHelper.GetStatus();
|
||||||
if (touchscreenStatus is not null)
|
Logger.WriteLine("Touchscreen status: " + status);
|
||||||
Program.toast.RunToast(Properties.Strings.Touchscreen + " " + ((bool)touchscreenStatus ? Properties.Strings.On : Properties.Strings.Off), ToastIcon.Touchpad);
|
if (status is not null)
|
||||||
|
{
|
||||||
|
Program.toast.RunToast(Properties.Strings.Touchscreen + " " + ((bool)status ? Properties.Strings.On : Properties.Strings.Off), ToastIcon.Touchpad);
|
||||||
|
TouchscreenHelper.ToggleTouchscreen((bool)status);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
public override int DPIIncrements()
|
public override int DPIIncrements()
|
||||||
{
|
{
|
||||||
return 100;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
||||||
|
if (AppConfig.Is("disable_power_event")) return;
|
||||||
SetAutoModes(true);
|
SetAutoModes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,13 +226,10 @@ namespace GHelper
|
|||||||
|
|
||||||
public void _VisualiseNewCount(int updatesCount, TableLayoutPanel table)
|
public void _VisualiseNewCount(int updatesCount, TableLayoutPanel table)
|
||||||
{
|
{
|
||||||
Invoke(delegate
|
labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
|
||||||
{
|
labelUpdates.ForeColor = colorTurbo;
|
||||||
labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
|
labelUpdates.Font = new Font(labelUpdates.Font, FontStyle.Bold);
|
||||||
labelUpdates.ForeColor = colorTurbo;
|
panelBios.AccessibleName = labelUpdates.Text;
|
||||||
labelUpdates.Font = new Font(labelUpdates.Font, FontStyle.Bold);
|
|
||||||
panelBios.AccessibleName = labelUpdates.Text;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static string CleanupDeviceId(string input)
|
static string CleanupDeviceId(string input)
|
||||||
|
|||||||
Reference in New Issue
Block a user