This commit is contained in:
Serge
2023-08-17 10:52:09 +02:00
parent 59f3aa9af4
commit 1e7bd816f2
3 changed files with 66 additions and 47 deletions

View File

@@ -79,7 +79,6 @@ public static class AppConfig
public static bool ContainsModel(string contains) public static bool ContainsModel(string contains)
{ {
GetModel(); GetModel();
return (_model is not null && _model.ToLower().Contains(contains.ToLower())); return (_model is not null && _model.ToLower().Contains(contains.ToLower()));
} }
@@ -354,7 +353,7 @@ public static class AppConfig
public static bool IsFanRequired() public static bool IsFanRequired()
{ {
return ContainsModel("GA402X") || ContainsModel("G513"); return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R");
} }
public static bool IsPowerRequired() public static bool IsPowerRequired()

View File

@@ -11,13 +11,13 @@ namespace Ryzen
internal class RyzenControl internal class RyzenControl
{ {
public const int MinCPUUV = -30; public static int MinCPUUV => AppConfig.Get("min_uv", -30);
public const int MaxCPUUV = 0; public const int MaxCPUUV = 0;
public const int MinIGPUUV = -20; public const int MinIGPUUV = -20;
public const int MaxIGPUUV = 0; public const int MaxIGPUUV = 0;
public const int MinTemp = 75; public static int MinTemp => AppConfig.Get("min_temp", 75);
public const int MaxTemp = 98; public const int MaxTemp = 98;
public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" }; public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" };

View File

@@ -7,7 +7,7 @@ using System.Text.Json;
namespace GHelper namespace GHelper
{ {
struct DriverDownload public struct DriverDownload
{ {
public string categoryName; public string categoryName;
public string title; public string title;
@@ -140,7 +140,63 @@ namespace GHelper
} }
} }
public async void DriversAsync(string url, int type, TableLayoutPanel table) public void VisualiseDriver(DriverDownload driver, TableLayoutPanel table)
{
Invoke(delegate
{
string versionText = driver.version.Replace("latest version at the ", "");
Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, AutoSize = true };
versionLabel.Cursor = Cursors.Hand;
versionLabel.Font = new Font(versionLabel.Font, FontStyle.Underline);
versionLabel.ForeColor = colorEco;
versionLabel.Padding = new Padding(5, 5, 5, 5);
versionLabel.Click += delegate
{
Process.Start(new ProcessStartInfo(driver.downloadUrl) { UseShellExecute = true });
};
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
table.Controls.Add(versionLabel, 2, table.RowCount);
table.RowCount++;
});
}
public void ShowTable(TableLayoutPanel table)
{
Invoke(delegate
{
table.Visible = true;
ResumeLayout(false);
PerformLayout();
});
}
public void VisualiseNewDriver(int position, TableLayoutPanel table)
{
var label = table.GetControlFromPosition(2, position) as Label;
if (label != null)
{
Invoke(delegate
{
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.ForeColor = colorTurbo;
});
}
}
public void VisualiseNewCount(int updatesCount, TableLayoutPanel table)
{
Invoke(delegate
{
labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
labelUpdates.ForeColor = colorTurbo;
labelUpdates.Font = new Font(labelUpdates.Font, FontStyle.Bold);
});
}
public async void DriversAsync(string url, int type, TableLayoutPanel table)
{ {
try try
@@ -185,39 +241,14 @@ namespace GHelper
driver.hardwares = file.GetProperty("HardwareInfoList"); driver.hardwares = file.GetProperty("HardwareInfoList");
drivers.Add(driver); drivers.Add(driver);
VisualiseDriver(driver, table);
Invoke(delegate
{
string versionText = driver.version.Replace("latest version at the ", "");
Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, AutoSize = true };
versionLabel.Cursor = Cursors.Hand;
versionLabel.Font = new Font(versionLabel.Font, FontStyle.Underline);
versionLabel.ForeColor = colorEco;
versionLabel.Padding = new Padding(5, 5, 5, 5);
versionLabel.Click += delegate
{
Process.Start(new ProcessStartInfo(driver.downloadUrl) { UseShellExecute = true });
};
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
table.Controls.Add(versionLabel, 2, table.RowCount);
table.RowCount++;
});
} }
oldTitle = title; oldTitle = title;
} }
} }
ShowTable(table);
Invoke(delegate
{
table.Visible = true;
ResumeLayout(false);
PerformLayout();
});
Dictionary<string, string> devices = new(); Dictionary<string, string> devices = new();
@@ -246,20 +277,9 @@ namespace GHelper
if (newer > 0) if (newer > 0)
{ {
var label = table.GetControlFromPosition(2, count) as Label; updatesCount++;
if (label != null) VisualiseNewDriver(count, table);
{ VisualiseNewCount(updatesCount, table);
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);
});
}
} }
count++; count++;