mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f6bdda39a | ||
|
|
96dc22072a | ||
|
|
3c02d5cd95 |
@@ -359,7 +359,7 @@ namespace GHelper
|
||||
if (device.ReadFeatureData(out byte[] data, AURA_HID_ID))
|
||||
{
|
||||
device.WriteFeatureData(msg);
|
||||
//device.WriteFeatureData(MESSAGE_SET);
|
||||
device.WriteFeatureData(MESSAGE_SET);
|
||||
device.WriteFeatureData(MESSAGE_APPLY);
|
||||
Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg));
|
||||
}
|
||||
|
||||
18
app/Fans.cs
18
app/Fans.cs
@@ -132,14 +132,14 @@ namespace GHelper
|
||||
labelFansResult.Visible = false;
|
||||
|
||||
|
||||
trackUV.Minimum = Undervolter.MinCPUUV;
|
||||
trackUV.Maximum = Undervolter.MaxCPUUV;
|
||||
trackUV.Minimum = RyzenControl.MinCPUUV;
|
||||
trackUV.Maximum = RyzenControl.MaxCPUUV;
|
||||
|
||||
trackUViGPU.Minimum = Undervolter.MinIGPUUV;
|
||||
trackUViGPU.Maximum = Undervolter.MaxIGPUUV;
|
||||
trackUViGPU.Minimum = RyzenControl.MinIGPUUV;
|
||||
trackUViGPU.Maximum = RyzenControl.MaxIGPUUV;
|
||||
|
||||
trackTemp.Minimum = Undervolter.MinTemp;
|
||||
trackTemp.Maximum = Undervolter.MaxTemp;
|
||||
trackTemp.Minimum = RyzenControl.MinTemp;
|
||||
trackTemp.Maximum = RyzenControl.MaxTemp;
|
||||
|
||||
|
||||
FillModes();
|
||||
@@ -270,7 +270,7 @@ namespace GHelper
|
||||
labelTemp.Text = trackTemp.Value.ToString() + "°C";
|
||||
|
||||
|
||||
buttonAdvanced.Visible = Undervolter.IsAMD();
|
||||
buttonAdvanced.Visible = RyzenControl.IsAMD();
|
||||
|
||||
}
|
||||
|
||||
@@ -622,13 +622,15 @@ namespace GHelper
|
||||
public void InitPower(bool changed = false)
|
||||
{
|
||||
|
||||
bool modeA0 = Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0 || Undervolter.IsAMD();
|
||||
bool modeA0 = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0 || RyzenControl.IsAMD());
|
||||
bool modeB0 = Program.acpi.IsAllAmdPPT();
|
||||
bool modeC1 = Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0;
|
||||
|
||||
panelA0.Visible = modeA0;
|
||||
panelB0.Visible = modeB0;
|
||||
|
||||
panelApplyPower.Visible = panelTitleCPU.Visible = modeA0 || modeB0 || modeC1;
|
||||
|
||||
|
||||
// All AMD version has B0 but doesn't have C0 (Nvidia GPU) settings
|
||||
if (modeB0)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.90</AssemblyVersion>
|
||||
<AssemblyVersion>0.91</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
61
app/Gpu/NvidiaSmi.cs
Normal file
61
app/Gpu/NvidiaSmi.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public static class NvidiaSmi
|
||||
{
|
||||
public static bool GetDisplayActiveStatus()
|
||||
{
|
||||
string commandOutput = RunNvidiaSmiCommand();
|
||||
|
||||
Logger.WriteLine(commandOutput);
|
||||
|
||||
if (commandOutput.Length == 0) return false;
|
||||
if (!commandOutput.Contains("RTX 40")) return false;
|
||||
|
||||
// Extract the "Display Active" status using regular expressions
|
||||
string displayActivePattern = @"Display Active\s+:\s+(\w+)";
|
||||
|
||||
Match match = Regex.Match(commandOutput, displayActivePattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
string status = match.Groups[1].Value.ToLower().Trim(' ');
|
||||
return status == "enabled";
|
||||
}
|
||||
|
||||
return false; // Return false if the "Display Active" status is not found
|
||||
}
|
||||
|
||||
private static string RunNvidiaSmiCommand(string arguments = "-i 0 -q")
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "nvidia-smi",
|
||||
Arguments = arguments,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
Process process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
return output;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//return File.ReadAllText(@"smi.txt");
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,14 @@ namespace GHelper
|
||||
{
|
||||
while (!cancellationTokenSource.Token.IsCancellationRequested)
|
||||
{
|
||||
|
||||
// Emergency break
|
||||
if (input == null || !input.IsConnected )
|
||||
{
|
||||
Logger.WriteLine("Listener terminated");
|
||||
break;
|
||||
}
|
||||
|
||||
var data = input.Read().Data;
|
||||
if (data.Length > 1 && data[0] == AsusUSB.INPUT_HID_ID && data[1] > 0 && data[1] != 236)
|
||||
{
|
||||
@@ -31,6 +39,7 @@ namespace GHelper
|
||||
KeyHandler(data[1]);
|
||||
}
|
||||
}
|
||||
|
||||
Logger.WriteLine("Listener stopped");
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace GHelper
|
||||
Application.EnableVisualStyles();
|
||||
|
||||
HardwareControl.RecreateGpuControl();
|
||||
Undervolter.Init();
|
||||
RyzenControl.Init();
|
||||
|
||||
var ds = settingsForm.Handle;
|
||||
|
||||
|
||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -390,6 +390,16 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_refresh_32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-refresh-32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -118,9 +118,6 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="brightness_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -169,6 +166,9 @@
|
||||
<data name="icons8-spa-flower-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-spa-flower-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_edit_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_share_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -181,6 +181,9 @@
|
||||
<data name="icons8-voltage-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-voltage-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="backlight_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -202,15 +205,12 @@
|
||||
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_edit_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="backlight_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -253,8 +253,8 @@
|
||||
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="backlight_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-boost-30" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-boost-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
@@ -268,4 +268,7 @@
|
||||
<data name="icons8-temperature-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-temperature-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-refresh-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
47
app/Properties/Strings.Designer.cs
generated
47
app/Properties/Strings.Designer.cs
generated
@@ -456,6 +456,26 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
|
||||
///
|
||||
///Do you still want to continue?.
|
||||
/// </summary>
|
||||
internal static string EnableOptimusText {
|
||||
get {
|
||||
return ResourceManager.GetString("EnableOptimusText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NVIDIA Display Mode is not set to Optimus.
|
||||
/// </summary>
|
||||
internal static string EnableOptimusTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("EnableOptimusTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Extra.
|
||||
/// </summary>
|
||||
@@ -861,6 +881,24 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New updates.
|
||||
/// </summary>
|
||||
internal static string NewUpdates {
|
||||
get {
|
||||
return ResourceManager.GetString("NewUpdates", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No new updates.
|
||||
/// </summary>
|
||||
internal static string NoNewUpdates {
|
||||
get {
|
||||
return ResourceManager.GetString("NoNewUpdates", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Open G-Helper window.
|
||||
/// </summary>
|
||||
@@ -1086,6 +1124,15 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stop GPU Applications.
|
||||
/// </summary>
|
||||
internal static string StopGPUApps {
|
||||
get {
|
||||
return ResourceManager.GetString("StopGPUApps", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stopping Services.
|
||||
/// </summary>
|
||||
|
||||
@@ -249,6 +249,14 @@
|
||||
<data name="EcoMode" xml:space="preserve">
|
||||
<value>Eco</value>
|
||||
</data>
|
||||
<data name="EnableOptimusText" xml:space="preserve">
|
||||
<value>Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
|
||||
|
||||
Do you still want to continue?</value>
|
||||
</data>
|
||||
<data name="EnableOptimusTitle" xml:space="preserve">
|
||||
<value>NVIDIA Display Mode is not set to Optimus</value>
|
||||
</data>
|
||||
<data name="Extra" xml:space="preserve">
|
||||
<value>Extra</value>
|
||||
</data>
|
||||
@@ -384,6 +392,12 @@
|
||||
<data name="MuteMic" xml:space="preserve">
|
||||
<value>Mute Mic</value>
|
||||
</data>
|
||||
<data name="NewUpdates" xml:space="preserve">
|
||||
<value>New updates</value>
|
||||
</data>
|
||||
<data name="NoNewUpdates" xml:space="preserve">
|
||||
<value>No new updates</value>
|
||||
</data>
|
||||
<data name="OpenGHelper" xml:space="preserve">
|
||||
<value>Open G-Helper window</value>
|
||||
</data>
|
||||
@@ -459,6 +473,9 @@
|
||||
<data name="Stop" xml:space="preserve">
|
||||
<value>Stop</value>
|
||||
</data>
|
||||
<data name="StopGPUApps" xml:space="preserve">
|
||||
<value>Stop GPU Applications</value>
|
||||
</data>
|
||||
<data name="StoppingServices" xml:space="preserve">
|
||||
<value>Stopping Services</value>
|
||||
</data>
|
||||
|
||||
BIN
app/Resources/icons8-refresh-32.png
Normal file
BIN
app/Resources/icons8-refresh-32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 486 B |
@@ -8,7 +8,7 @@ using System.Management;
|
||||
|
||||
namespace Ryzen
|
||||
{
|
||||
internal class Undervolter
|
||||
internal class RyzenControl
|
||||
{
|
||||
|
||||
public const int MinCPUUV = -30;
|
||||
@@ -136,14 +136,14 @@ namespace Ryzen
|
||||
public Status SendMp1(uint message, ref uint[] arguments)
|
||||
{
|
||||
var result = SendMsg(MP1_ADDR_MSG, MP1_ADDR_RSP, MP1_ADDR_ARG, message, ref arguments);
|
||||
Logger.WriteLine($"RyzenMP1:{message} {arguments[0]} {result}");
|
||||
//Logger.WriteLine($"RyzenMP1:{message} {arguments[0]} {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public Status SendPsmu(uint message, ref uint[] arguments)
|
||||
{
|
||||
var result = SendMsg(PSMU_ADDR_MSG, PSMU_ADDR_RSP, PSMU_ADDR_ARG, message, ref arguments);
|
||||
Logger.WriteLine($"RyzenPSMU:{message} {arguments[0]} {result}");
|
||||
//Logger.WriteLine($"RyzenPSMU:{message} {arguments[0]} {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Ryzen
|
||||
//RAPHAEL/DRAGON RANGE - 10
|
||||
|
||||
public static Smu RyzenAccess = new Smu(false);
|
||||
public static int FAMID = Undervolter.FAMID;
|
||||
public static int FAMID = RyzenControl.FAMID;
|
||||
|
||||
|
||||
//STAMP Limit
|
||||
|
||||
37
app/Settings.Designer.cs
generated
37
app/Settings.Designer.cs
generated
@@ -97,6 +97,7 @@ namespace GHelper
|
||||
labelVersion = new Label();
|
||||
labelModel = new Label();
|
||||
panelVersion = new Panel();
|
||||
buttonStopGPU = new RButton();
|
||||
panelMatrix.SuspendLayout();
|
||||
tableLayoutMatrix.SuspendLayout();
|
||||
panelMatrixTitle.SuspendLayout();
|
||||
@@ -592,6 +593,7 @@ namespace GHelper
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
tableGPU.Controls.Add(buttonStopGPU, 0, 0);
|
||||
tableGPU.Controls.Add(buttonEco, 0, 0);
|
||||
tableGPU.Controls.Add(buttonStandard, 1, 0);
|
||||
tableGPU.Controls.Add(buttonXGM, 2, 0);
|
||||
@@ -664,11 +666,11 @@ namespace GHelper
|
||||
buttonXGM.ForeColor = SystemColors.ControlText;
|
||||
buttonXGM.Image = Properties.Resources.icons8_video_48;
|
||||
buttonXGM.ImageAlign = ContentAlignment.BottomCenter;
|
||||
buttonXGM.Location = new Point(4, 132);
|
||||
buttonXGM.Location = new Point(580, 4);
|
||||
buttonXGM.Margin = new Padding(4);
|
||||
buttonXGM.Name = "buttonXGM";
|
||||
buttonXGM.Secondary = false;
|
||||
buttonXGM.Size = new Size(184, 120);
|
||||
buttonXGM.Size = new Size(186, 120);
|
||||
buttonXGM.TabIndex = 2;
|
||||
buttonXGM.Text = "XG Mobile";
|
||||
buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText;
|
||||
@@ -687,11 +689,11 @@ namespace GHelper
|
||||
buttonOptimized.ForeColor = SystemColors.ControlText;
|
||||
buttonOptimized.Image = Properties.Resources.icons8_project_management_48__1_;
|
||||
buttonOptimized.ImageAlign = ContentAlignment.BottomCenter;
|
||||
buttonOptimized.Location = new Point(580, 4);
|
||||
buttonOptimized.Location = new Point(388, 4);
|
||||
buttonOptimized.Margin = new Padding(4);
|
||||
buttonOptimized.Name = "buttonOptimized";
|
||||
buttonOptimized.Secondary = false;
|
||||
buttonOptimized.Size = new Size(186, 120);
|
||||
buttonOptimized.Size = new Size(184, 120);
|
||||
buttonOptimized.TabIndex = 3;
|
||||
buttonOptimized.Text = Properties.Strings.Optimized;
|
||||
buttonOptimized.TextImageRelation = TextImageRelation.ImageAboveText;
|
||||
@@ -709,7 +711,7 @@ namespace GHelper
|
||||
buttonUltimate.ForeColor = SystemColors.ControlText;
|
||||
buttonUltimate.Image = Properties.Resources.icons8_game_controller_48;
|
||||
buttonUltimate.ImageAlign = ContentAlignment.BottomCenter;
|
||||
buttonUltimate.Location = new Point(388, 4);
|
||||
buttonUltimate.Location = new Point(4, 132);
|
||||
buttonUltimate.Margin = new Padding(4);
|
||||
buttonUltimate.Name = "buttonUltimate";
|
||||
buttonUltimate.Secondary = false;
|
||||
@@ -1118,6 +1120,30 @@ namespace GHelper
|
||||
panelVersion.Size = new Size(810, 57);
|
||||
panelVersion.TabIndex = 41;
|
||||
//
|
||||
// buttonStopGPU
|
||||
//
|
||||
buttonStopGPU.Activated = false;
|
||||
buttonStopGPU.BackColor = SystemColors.ControlLightLight;
|
||||
buttonStopGPU.BorderColor = Color.Transparent;
|
||||
buttonStopGPU.BorderRadius = 5;
|
||||
buttonStopGPU.CausesValidation = false;
|
||||
buttonStopGPU.Dock = DockStyle.Top;
|
||||
buttonStopGPU.FlatAppearance.BorderSize = 0;
|
||||
buttonStopGPU.FlatStyle = FlatStyle.Flat;
|
||||
buttonStopGPU.ForeColor = SystemColors.ControlText;
|
||||
buttonStopGPU.Image = Properties.Resources.icons8_leaf_48;
|
||||
buttonStopGPU.ImageAlign = ContentAlignment.BottomCenter;
|
||||
buttonStopGPU.Location = new Point(196, 132);
|
||||
buttonStopGPU.Margin = new Padding(4);
|
||||
buttonStopGPU.Name = "buttonStopGPU";
|
||||
buttonStopGPU.Secondary = false;
|
||||
buttonStopGPU.Size = new Size(184, 120);
|
||||
buttonStopGPU.TabIndex = 4;
|
||||
buttonStopGPU.Text = "Stop GPU applications";
|
||||
buttonStopGPU.TextImageRelation = TextImageRelation.ImageAboveText;
|
||||
buttonStopGPU.UseVisualStyleBackColor = false;
|
||||
buttonStopGPU.Visible = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
@@ -1255,5 +1281,6 @@ namespace GHelper
|
||||
private Panel panelVersion;
|
||||
private Label labelVersion;
|
||||
private Label labelModel;
|
||||
private RButton buttonStopGPU;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace GHelper
|
||||
buttonUltimate.Text = Properties.Strings.UltimateMode;
|
||||
buttonStandard.Text = Properties.Strings.StandardMode;
|
||||
buttonOptimized.Text = Properties.Strings.Optimized;
|
||||
|
||||
buttonStopGPU.Text = Properties.Strings.StopGPUApps;
|
||||
|
||||
buttonScreenAuto.Text = Properties.Strings.AutoMode;
|
||||
buttonMiniled.Text = Properties.Strings.Multizone;
|
||||
@@ -102,6 +102,7 @@ namespace GHelper
|
||||
buttonStandard.Click += ButtonStandard_Click;
|
||||
buttonUltimate.Click += ButtonUltimate_Click;
|
||||
buttonOptimized.Click += ButtonOptimized_Click;
|
||||
buttonStopGPU.Click += ButtonStopGPU_Click;
|
||||
|
||||
VisibleChanged += SettingsForm_VisibleChanged;
|
||||
|
||||
@@ -186,6 +187,7 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
|
||||
{
|
||||
aTimer.Enabled = this.Visible;
|
||||
@@ -988,6 +990,12 @@ namespace GHelper
|
||||
SetGPUMode(AsusACPI.GPUModeEco);
|
||||
}
|
||||
|
||||
|
||||
private void ButtonStopGPU_Click(object? sender, EventArgs e)
|
||||
{
|
||||
HardwareControl.KillGPUApps();
|
||||
}
|
||||
|
||||
public async void RefreshSensors(bool force = false)
|
||||
{
|
||||
|
||||
@@ -1058,7 +1066,8 @@ namespace GHelper
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_TotalA0, limit_total, "PowerLimit A0");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, limit_total, "PowerLimit A3");
|
||||
customPower = limit_total;
|
||||
} else if (Undervolter.IsAMD())
|
||||
}
|
||||
else if (RyzenControl.IsAMD())
|
||||
{
|
||||
|
||||
if (ProcessHelper.IsUserAdministrator())
|
||||
@@ -1068,7 +1077,8 @@ namespace GHelper
|
||||
SendCommand.set_slow_limit((uint)limit_total * 1000);
|
||||
SendCommand.set_fast_limit((uint)limit_total * 1000);
|
||||
customPower = limit_total;
|
||||
} else if (launchAsAdmin)
|
||||
}
|
||||
else if (launchAsAdmin)
|
||||
{
|
||||
ProcessHelper.RunAsAdmin("cpu");
|
||||
return;
|
||||
@@ -1156,14 +1166,14 @@ namespace GHelper
|
||||
|
||||
public void SetUV(bool launchAsAdmin = false)
|
||||
{
|
||||
|
||||
|
||||
if (!ProcessHelper.IsUserAdministrator())
|
||||
{
|
||||
if (launchAsAdmin) ProcessHelper.RunAsAdmin("uv");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Undervolter.IsAMD()) return;
|
||||
if (!RyzenControl.IsAMD()) return;
|
||||
|
||||
int cpuUV = AppConfig.GetMode("cpu_uv", 0);
|
||||
int igpuUV = AppConfig.GetMode("igpu_uv", 0);
|
||||
@@ -1171,17 +1181,17 @@ namespace GHelper
|
||||
|
||||
try
|
||||
{
|
||||
if (cpuUV >= Undervolter.MinCPUUV && cpuUV <= Undervolter.MaxCPUUV)
|
||||
if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV)
|
||||
{
|
||||
SendCommand.set_coall(cpuUV);
|
||||
}
|
||||
|
||||
if (igpuUV >= Undervolter.MinIGPUUV && igpuUV <= Undervolter.MaxIGPUUV)
|
||||
if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV)
|
||||
{
|
||||
SendCommand.set_cogfx(igpuUV);
|
||||
}
|
||||
|
||||
if (cpuTemp >= Undervolter.MinTemp && cpuTemp <= Undervolter.MaxTemp)
|
||||
if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp)
|
||||
{
|
||||
SendCommand.set_tctl_temp((uint)cpuTemp);
|
||||
SendCommand.set_apu_skin_temp_limit((uint)cpuTemp);
|
||||
@@ -1255,13 +1265,14 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
private static bool isManualModeRequired()
|
||||
private static bool IsManualModeRequired()
|
||||
{
|
||||
if (!AppConfig.IsMode("auto_apply_power"))
|
||||
return false;
|
||||
|
||||
return
|
||||
AppConfig.Is("manual_mode") ||
|
||||
AppConfig.ContainsModel("GU603") ||
|
||||
AppConfig.ContainsModel("GU604") ||
|
||||
AppConfig.ContainsModel("FX517") ||
|
||||
AppConfig.ContainsModel("G733");
|
||||
@@ -1286,7 +1297,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
// Fix for models that don't support PPT settings in all modes, setting a "manual" mode for them
|
||||
if (isManualModeRequired() && !applyFans)
|
||||
if (IsManualModeRequired() && !applyFans)
|
||||
{
|
||||
AutoFans(true);
|
||||
}
|
||||
@@ -1376,7 +1387,7 @@ namespace GHelper
|
||||
|
||||
SetPerformanceLabel();
|
||||
|
||||
if (isManualModeRequired())
|
||||
if (IsManualModeRequired())
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AsusACPI.PerformanceManual, "Manual Mode");
|
||||
else
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Modes.GetBase(mode), "Mode");
|
||||
@@ -1541,20 +1552,6 @@ namespace GHelper
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UltimateUI(bool ultimate)
|
||||
{
|
||||
if (!ultimate)
|
||||
{
|
||||
tableGPU.Controls.Remove(buttonUltimate);
|
||||
tablePerf.ColumnCount = 0;
|
||||
tableGPU.ColumnCount = 0;
|
||||
tableScreen.ColumnCount = 0;
|
||||
menuUltimate.Visible = false;
|
||||
|
||||
}
|
||||
//tableLayoutMatrix.ColumnCount = 0;
|
||||
}
|
||||
|
||||
public void InitXGM()
|
||||
{
|
||||
bool connected = Program.acpi.IsXGConnected();
|
||||
@@ -1605,12 +1602,28 @@ namespace GHelper
|
||||
else
|
||||
GpuMode = AsusACPI.GPUModeStandard;
|
||||
|
||||
UltimateUI(mux == 1);
|
||||
// Ultimate mode not suported
|
||||
if (mux != 1)
|
||||
{
|
||||
tableGPU.Controls.Remove(buttonUltimate);
|
||||
tablePerf.ColumnCount = 0;
|
||||
tableGPU.ColumnCount = 0;
|
||||
tableScreen.ColumnCount = 0;
|
||||
menuUltimate.Visible = false;
|
||||
}
|
||||
|
||||
if (eco < 0 && mux < 0)
|
||||
{
|
||||
isGpuSection = tableGPU.Visible = false;
|
||||
isGpuSection = false;
|
||||
|
||||
buttonEco.Visible = false;
|
||||
buttonStandard.Visible = false;
|
||||
buttonUltimate.Visible = false;
|
||||
buttonOptimized.Visible = false;
|
||||
buttonStopGPU.Visible = true;
|
||||
|
||||
SetContextMenu();
|
||||
|
||||
if (HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is null) panelGPU.Visible = false;
|
||||
}
|
||||
|
||||
@@ -1688,7 +1701,20 @@ namespace GHelper
|
||||
|
||||
int status = 1;
|
||||
|
||||
if (eco == 1) HardwareControl.KillGPUApps();
|
||||
if (eco == 1)
|
||||
{
|
||||
if (NvidiaSmi.GetDisplayActiveStatus())
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show(Properties.Strings.EnableOptimusText, Properties.Strings.EnableOptimusTitle, MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.No)
|
||||
{
|
||||
InitGPUMode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HardwareControl.KillGPUApps();
|
||||
}
|
||||
|
||||
Logger.WriteLine($"Running eco command {eco}");
|
||||
|
||||
|
||||
105
app/Updates.Designer.cs
generated
105
app/Updates.Designer.cs
generated
@@ -33,6 +33,8 @@
|
||||
labelBIOS = new Label();
|
||||
pictureBios = new PictureBox();
|
||||
panelBiosTitle = new Panel();
|
||||
labelUpdates = new Label();
|
||||
buttonRefresh = new CustomControls.RButton();
|
||||
panelBios = new Panel();
|
||||
panelDrivers = new Panel();
|
||||
tableDrivers = new TableLayoutPanel();
|
||||
@@ -56,21 +58,21 @@
|
||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
tableBios.Dock = DockStyle.Top;
|
||||
tableBios.Location = new Point(10, 10);
|
||||
tableBios.Margin = new Padding(2);
|
||||
tableBios.MinimumSize = new Size(550, 0);
|
||||
tableBios.Location = new Point(20, 20);
|
||||
tableBios.Margin = new Padding(4);
|
||||
tableBios.MinimumSize = new Size(1100, 0);
|
||||
tableBios.Name = "tableBios";
|
||||
tableBios.Size = new Size(608, 0);
|
||||
tableBios.Size = new Size(1216, 0);
|
||||
tableBios.TabIndex = 0;
|
||||
//
|
||||
// labelBIOS
|
||||
//
|
||||
labelBIOS.AutoSize = true;
|
||||
labelBIOS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBIOS.Location = new Point(34, 14);
|
||||
labelBIOS.Margin = new Padding(2, 0, 2, 0);
|
||||
labelBIOS.Location = new Point(68, 23);
|
||||
labelBIOS.Margin = new Padding(4, 0, 4, 0);
|
||||
labelBIOS.Name = "labelBIOS";
|
||||
labelBIOS.Size = new Size(35, 15);
|
||||
labelBIOS.Size = new Size(68, 32);
|
||||
labelBIOS.TabIndex = 1;
|
||||
labelBIOS.Text = "BIOS";
|
||||
//
|
||||
@@ -78,34 +80,63 @@
|
||||
//
|
||||
pictureBios.BackgroundImage = (Image)resources.GetObject("pictureBios.BackgroundImage");
|
||||
pictureBios.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureBios.Location = new Point(14, 14);
|
||||
pictureBios.Margin = new Padding(2);
|
||||
pictureBios.Location = new Point(28, 23);
|
||||
pictureBios.Margin = new Padding(4);
|
||||
pictureBios.Name = "pictureBios";
|
||||
pictureBios.Size = new Size(16, 16);
|
||||
pictureBios.Size = new Size(32, 32);
|
||||
pictureBios.TabIndex = 2;
|
||||
pictureBios.TabStop = false;
|
||||
//
|
||||
// panelBiosTitle
|
||||
//
|
||||
panelBiosTitle.Controls.Add(labelUpdates);
|
||||
panelBiosTitle.Controls.Add(buttonRefresh);
|
||||
panelBiosTitle.Controls.Add(labelBIOS);
|
||||
panelBiosTitle.Controls.Add(pictureBios);
|
||||
panelBiosTitle.Dock = DockStyle.Top;
|
||||
panelBiosTitle.Location = new Point(0, 0);
|
||||
panelBiosTitle.Margin = new Padding(2);
|
||||
panelBiosTitle.Margin = new Padding(4);
|
||||
panelBiosTitle.Name = "panelBiosTitle";
|
||||
panelBiosTitle.Size = new Size(628, 31);
|
||||
panelBiosTitle.Size = new Size(1256, 62);
|
||||
panelBiosTitle.TabIndex = 3;
|
||||
//
|
||||
// labelUpdates
|
||||
//
|
||||
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelUpdates.Location = new Point(941, 23);
|
||||
labelUpdates.Name = "labelUpdates";
|
||||
labelUpdates.Size = new Size(245, 32);
|
||||
labelUpdates.TabIndex = 4;
|
||||
labelUpdates.Text = "Updates Available";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Activated = false;
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonRefresh.BackColor = SystemColors.ControlLight;
|
||||
buttonRefresh.BorderColor = Color.Transparent;
|
||||
buttonRefresh.BorderRadius = 5;
|
||||
buttonRefresh.FlatAppearance.BorderSize = 0;
|
||||
buttonRefresh.FlatStyle = FlatStyle.Flat;
|
||||
buttonRefresh.Image = Properties.Resources.icons8_refresh_32;
|
||||
buttonRefresh.Location = new Point(1183, 14);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Secondary = true;
|
||||
buttonRefresh.Size = new Size(52, 46);
|
||||
buttonRefresh.TabIndex = 3;
|
||||
buttonRefresh.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// panelBios
|
||||
//
|
||||
panelBios.AutoSize = true;
|
||||
panelBios.Controls.Add(tableBios);
|
||||
panelBios.Dock = DockStyle.Top;
|
||||
panelBios.Location = new Point(0, 31);
|
||||
panelBios.Margin = new Padding(2);
|
||||
panelBios.Location = new Point(0, 62);
|
||||
panelBios.Margin = new Padding(4);
|
||||
panelBios.Name = "panelBios";
|
||||
panelBios.Padding = new Padding(10);
|
||||
panelBios.Size = new Size(628, 20);
|
||||
panelBios.Padding = new Padding(20);
|
||||
panelBios.Size = new Size(1256, 40);
|
||||
panelBios.TabIndex = 4;
|
||||
//
|
||||
// panelDrivers
|
||||
@@ -113,11 +144,11 @@
|
||||
panelDrivers.AutoSize = true;
|
||||
panelDrivers.Controls.Add(tableDrivers);
|
||||
panelDrivers.Dock = DockStyle.Top;
|
||||
panelDrivers.Location = new Point(0, 73);
|
||||
panelDrivers.Margin = new Padding(2);
|
||||
panelDrivers.Location = new Point(0, 146);
|
||||
panelDrivers.Margin = new Padding(4);
|
||||
panelDrivers.Name = "panelDrivers";
|
||||
panelDrivers.Padding = new Padding(10);
|
||||
panelDrivers.Size = new Size(628, 20);
|
||||
panelDrivers.Padding = new Padding(20);
|
||||
panelDrivers.Size = new Size(1256, 40);
|
||||
panelDrivers.TabIndex = 6;
|
||||
//
|
||||
// tableDrivers
|
||||
@@ -129,11 +160,11 @@
|
||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||
tableDrivers.Dock = DockStyle.Top;
|
||||
tableDrivers.Location = new Point(10, 10);
|
||||
tableDrivers.Margin = new Padding(2);
|
||||
tableDrivers.MinimumSize = new Size(550, 0);
|
||||
tableDrivers.Location = new Point(20, 20);
|
||||
tableDrivers.Margin = new Padding(4);
|
||||
tableDrivers.MinimumSize = new Size(1100, 0);
|
||||
tableDrivers.Name = "tableDrivers";
|
||||
tableDrivers.Size = new Size(608, 0);
|
||||
tableDrivers.Size = new Size(1216, 0);
|
||||
tableDrivers.TabIndex = 0;
|
||||
//
|
||||
// panelDriversTitle
|
||||
@@ -141,20 +172,20 @@
|
||||
panelDriversTitle.Controls.Add(labelDrivers);
|
||||
panelDriversTitle.Controls.Add(pictureDrivers);
|
||||
panelDriversTitle.Dock = DockStyle.Top;
|
||||
panelDriversTitle.Location = new Point(0, 51);
|
||||
panelDriversTitle.Margin = new Padding(2);
|
||||
panelDriversTitle.Location = new Point(0, 102);
|
||||
panelDriversTitle.Margin = new Padding(4);
|
||||
panelDriversTitle.Name = "panelDriversTitle";
|
||||
panelDriversTitle.Size = new Size(628, 22);
|
||||
panelDriversTitle.Size = new Size(1256, 44);
|
||||
panelDriversTitle.TabIndex = 5;
|
||||
//
|
||||
// labelDrivers
|
||||
//
|
||||
labelDrivers.AutoSize = true;
|
||||
labelDrivers.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelDrivers.Location = new Point(34, 4);
|
||||
labelDrivers.Margin = new Padding(2, 0, 2, 0);
|
||||
labelDrivers.Location = new Point(68, 6);
|
||||
labelDrivers.Margin = new Padding(4, 0, 4, 0);
|
||||
labelDrivers.Name = "labelDrivers";
|
||||
labelDrivers.Size = new Size(126, 15);
|
||||
labelDrivers.Size = new Size(254, 32);
|
||||
labelDrivers.TabIndex = 1;
|
||||
labelDrivers.Text = "Drivers and Software";
|
||||
//
|
||||
@@ -162,24 +193,24 @@
|
||||
//
|
||||
pictureDrivers.BackgroundImage = (Image)resources.GetObject("pictureDrivers.BackgroundImage");
|
||||
pictureDrivers.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureDrivers.Location = new Point(14, 4);
|
||||
pictureDrivers.Margin = new Padding(2);
|
||||
pictureDrivers.Location = new Point(28, 6);
|
||||
pictureDrivers.Margin = new Padding(4);
|
||||
pictureDrivers.Name = "pictureDrivers";
|
||||
pictureDrivers.Size = new Size(16, 16);
|
||||
pictureDrivers.Size = new Size(32, 32);
|
||||
pictureDrivers.TabIndex = 2;
|
||||
pictureDrivers.TabStop = false;
|
||||
//
|
||||
// Updates
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(96F, 96F);
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoScroll = true;
|
||||
ClientSize = new Size(628, 345);
|
||||
ClientSize = new Size(1256, 690);
|
||||
Controls.Add(panelDrivers);
|
||||
Controls.Add(panelDriversTitle);
|
||||
Controls.Add(panelBios);
|
||||
Controls.Add(panelBiosTitle);
|
||||
Margin = new Padding(2);
|
||||
Margin = new Padding(4);
|
||||
MinimizeBox = false;
|
||||
Name = "Updates";
|
||||
ShowIcon = false;
|
||||
@@ -211,5 +242,7 @@
|
||||
private Panel panelDriversTitle;
|
||||
private Label labelDrivers;
|
||||
private PictureBox pictureDrivers;
|
||||
private CustomControls.RButton buttonRefresh;
|
||||
private Label labelUpdates;
|
||||
}
|
||||
}
|
||||
@@ -22,21 +22,34 @@ namespace GHelper
|
||||
static string model;
|
||||
static string bios;
|
||||
|
||||
public Updates()
|
||||
static int updatesCount = 0;
|
||||
private static long lastUpdate;
|
||||
|
||||
private void LoadUpdates()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitTheme();
|
||||
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastUpdate) < 5000) return;
|
||||
lastUpdate = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
InitBiosAndModel();
|
||||
|
||||
updatesCount = 0;
|
||||
labelUpdates.ForeColor = colorEco;
|
||||
labelUpdates.Text = Properties.Strings.NoNewUpdates;
|
||||
|
||||
|
||||
Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + bios;
|
||||
labelBIOS.Text = "BIOS";
|
||||
labelDrivers.Text = Properties.Strings.DriverAndSoftware;
|
||||
|
||||
SuspendLayout();
|
||||
|
||||
tableBios.Visible = false;
|
||||
tableDrivers.Visible = false;
|
||||
|
||||
ClearTable(tableBios);
|
||||
ClearTable(tableDrivers);
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDBIOS?website=global&model={model}&cpu=", 1, tableBios);
|
||||
@@ -46,10 +59,36 @@ namespace GHelper
|
||||
{
|
||||
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDDrivers?website=global&model={model}&cpu={model}&osid=52", 0, tableDrivers);
|
||||
});
|
||||
}
|
||||
|
||||
private void ClearTable(TableLayoutPanel tableLayoutPanel)
|
||||
{
|
||||
while (tableLayoutPanel.Controls.Count > 0)
|
||||
{
|
||||
tableLayoutPanel.Controls[0].Dispose();
|
||||
}
|
||||
|
||||
tableLayoutPanel.RowCount = 0;
|
||||
}
|
||||
|
||||
public Updates()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitTheme(true);
|
||||
|
||||
|
||||
LoadUpdates();
|
||||
|
||||
//buttonRefresh.Visible = false;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
Shown += Updates_Shown;
|
||||
}
|
||||
|
||||
private void ButtonRefresh_Click(object? sender, EventArgs e)
|
||||
{
|
||||
LoadUpdates();
|
||||
}
|
||||
|
||||
private void Updates_Shown(object? sender, EventArgs e)
|
||||
{
|
||||
Height = Program.settingsForm.Height;
|
||||
@@ -114,6 +153,7 @@ namespace GHelper
|
||||
httpClient.DefaultRequestHeaders.AcceptEncoding.ParseAdd("gzip, deflate, br");
|
||||
httpClient.DefaultRequestHeaders.Add("User-Agent", "C# App");
|
||||
var json = await httpClient.GetStringAsync(url);
|
||||
|
||||
var data = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
var groups = data.GetProperty("Result").GetProperty("Obj");
|
||||
|
||||
@@ -145,6 +185,7 @@ namespace GHelper
|
||||
driver.hardwares = file.GetProperty("HardwareInfoList");
|
||||
drivers.Add(driver);
|
||||
|
||||
|
||||
Invoke(delegate
|
||||
{
|
||||
string versionText = driver.version.Replace("latest version at the ", "");
|
||||
@@ -170,6 +211,7 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Invoke(delegate
|
||||
{
|
||||
table.Visible = true;
|
||||
@@ -177,6 +219,7 @@ namespace GHelper
|
||||
PerformLayout();
|
||||
});
|
||||
|
||||
|
||||
Dictionary<string, string> devices = new();
|
||||
if (type == 0) devices = GetDeviceVersions();
|
||||
|
||||
@@ -208,8 +251,13 @@ namespace GHelper
|
||||
{
|
||||
Invoke(delegate
|
||||
{
|
||||
updatesCount++;
|
||||
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
|
||||
label.ForeColor = colorTurbo;
|
||||
|
||||
labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
|
||||
labelUpdates.ForeColor = colorTurbo;
|
||||
labelUpdates.Font = new Font(label.Font, FontStyle.Bold);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -217,6 +265,8 @@ namespace GHelper
|
||||
count++;
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user