mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Config overrides https://github.com/seerge/g-helper/issues/1105
This commit is contained in:
@@ -79,7 +79,6 @@ public static class AppConfig
|
||||
|
||||
public static bool ContainsModel(string contains)
|
||||
{
|
||||
|
||||
GetModel();
|
||||
return (_model is not null && _model.ToLower().Contains(contains.ToLower()));
|
||||
}
|
||||
@@ -354,7 +353,7 @@ public static class AppConfig
|
||||
|
||||
public static bool IsFanRequired()
|
||||
{
|
||||
return ContainsModel("GA402X") || ContainsModel("G513");
|
||||
return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R");
|
||||
}
|
||||
|
||||
public static bool IsPowerRequired()
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace Ryzen
|
||||
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 MinIGPUUV = -20;
|
||||
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 static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" };
|
||||
|
||||
102
app/Updates.cs
102
app/Updates.cs
@@ -7,7 +7,7 @@ using System.Text.Json;
|
||||
namespace GHelper
|
||||
{
|
||||
|
||||
struct DriverDownload
|
||||
public struct DriverDownload
|
||||
{
|
||||
public string categoryName;
|
||||
public string title;
|
||||
@@ -140,6 +140,62 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -185,39 +241,14 @@ namespace GHelper
|
||||
driver.hardwares = file.GetProperty("HardwareInfoList");
|
||||
drivers.Add(driver);
|
||||
|
||||
|
||||
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++;
|
||||
});
|
||||
VisualiseDriver(driver, table);
|
||||
}
|
||||
|
||||
oldTitle = title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Invoke(delegate
|
||||
{
|
||||
table.Visible = true;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
});
|
||||
ShowTable(table);
|
||||
|
||||
|
||||
Dictionary<string, string> devices = new();
|
||||
@@ -245,21 +276,10 @@ namespace GHelper
|
||||
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
||||
|
||||
if (newer > 0)
|
||||
{
|
||||
var label = table.GetControlFromPosition(2, count) as Label;
|
||||
if (label != null)
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
VisualiseNewDriver(count, table);
|
||||
VisualiseNewCount(updatesCount, table);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
Reference in New Issue
Block a user