mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Driver updater fix
This commit is contained in:
@@ -63,22 +63,6 @@ public static class AppConfig
|
||||
return (_model is not null && _model.ToLower().Contains(contains.ToLower()));
|
||||
}
|
||||
|
||||
public static string GetModelShort()
|
||||
{
|
||||
GetModel();
|
||||
if (_model is not null)
|
||||
{
|
||||
int trim = _model.LastIndexOf("_");
|
||||
if (trim > 0) return _model.Substring(trim+1);
|
||||
|
||||
trim = _model.LastIndexOf(" ");
|
||||
if (trim > 0) return _model.Substring(trim + 1);
|
||||
|
||||
return _model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private static void initConfig()
|
||||
{
|
||||
|
||||
@@ -245,8 +245,6 @@ namespace GHelper
|
||||
labelServices.Text = Properties.Strings.AsusServicesRunning + ": " + OptimizationService.GetRunningCount();
|
||||
buttonServices.Enabled = true;
|
||||
|
||||
Program.inputDispatcher.Init();
|
||||
|
||||
}
|
||||
|
||||
public void ServiesToggle()
|
||||
@@ -263,6 +261,7 @@ namespace GHelper
|
||||
{
|
||||
InitServices();
|
||||
});
|
||||
Program.inputDispatcher.Init();
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -20,14 +20,17 @@ namespace GHelper
|
||||
public partial class Updates : RForm
|
||||
{
|
||||
//static int rowCount = 0;
|
||||
static string model = AppConfig.GetModelShort();
|
||||
static string model;
|
||||
static string bios;
|
||||
|
||||
public Updates()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitTheme();
|
||||
|
||||
Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + GetBiosVersion();
|
||||
InitBiosAndModel();
|
||||
|
||||
Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + bios;
|
||||
labelBIOS.Text = "BIOS";
|
||||
labelDrivers.Text = Properties.Strings.DriverAndSoftware;
|
||||
|
||||
@@ -73,7 +76,7 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
private string GetBiosVersion()
|
||||
private string InitBiosAndModel()
|
||||
{
|
||||
using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS"))
|
||||
{
|
||||
@@ -82,10 +85,15 @@ namespace GHelper
|
||||
foreach (ManagementObject obj in objCollection)
|
||||
if (obj["SMBIOSBIOSVersion"] is not null)
|
||||
{
|
||||
var bios = obj["SMBIOSBIOSVersion"].ToString();
|
||||
int trim = bios.LastIndexOf(".");
|
||||
if (trim > 0) return bios.Substring(trim + 1);
|
||||
else return bios;
|
||||
string[] results = obj["SMBIOSBIOSVersion"].ToString().Split(".");
|
||||
if (results.Length > 1)
|
||||
{
|
||||
model = results[0];
|
||||
bios = results[1];
|
||||
} else
|
||||
{
|
||||
model = obj["SMBIOSBIOSVersion"].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
@@ -140,7 +148,7 @@ namespace GHelper
|
||||
BeginInvoke(delegate
|
||||
{
|
||||
string versionText = driver.version.Replace("latest version at the ", "");
|
||||
Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Height = 50 };
|
||||
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;
|
||||
@@ -170,10 +178,7 @@ namespace GHelper
|
||||
});
|
||||
|
||||
Dictionary<string, string> devices = new();
|
||||
string biosVersion = "0";
|
||||
|
||||
if (type == 0) devices = GetDeviceVersions();
|
||||
else biosVersion = GetBiosVersion();
|
||||
|
||||
//Debug.WriteLine(biosVersion);
|
||||
|
||||
@@ -194,7 +199,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
if (type == 1)
|
||||
newer = Int32.Parse(driver.version) > Int32.Parse(biosVersion) ? 1 : -1;
|
||||
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
||||
|
||||
if (newer > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user