Skip to content

Commit

Permalink
Fixed raw bios version on About Page
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Jun 24, 2023
1 parent 223c422 commit b034f2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions LenovoLegionToolkit.Lib/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public readonly struct CompatibilityProperties
public string Model { get; init; }
public string SerialNumber { get; init; }
public BiosVersion? BiosVersion { get; init; }
public string? BiosVersionRaw { get; init; }
public CompatibilityProperties Properties { get; init; }
}

Expand Down
11 changes: 6 additions & 5 deletions LenovoLegionToolkit.Lib/Utils/Compatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static async Task<MachineInformation> GetMachineInformationAsync()
if (!_machineInformation.HasValue)
{
var (vendor, machineType, model, serialNumber) = await GetModelDataAsync().ConfigureAwait(false);
var biosVersion = await GetBIOSVersionAsync().ConfigureAwait(false);
var (biosVersion, biosVersionRaw) = await GetBIOSVersionAsync().ConfigureAwait(false);

var machineInformation = new MachineInformation
{
Expand All @@ -87,6 +87,7 @@ public static async Task<MachineInformation> GetMachineInformationAsync()
Model = model,
SerialNumber = serialNumber,
BiosVersion = biosVersion,
BiosVersionRaw = biosVersionRaw,
Properties = new()
{
SupportsAlwaysOnAc = GetAlwaysOnAcStatus(),
Expand All @@ -107,7 +108,7 @@ public static async Task<MachineInformation> GetMachineInformationAsync()
Log.Instance.Trace($" * Vendor: '{machineInformation.Vendor}'");
Log.Instance.Trace($" * Machine Type: '{machineInformation.MachineType}'");
Log.Instance.Trace($" * Model: '{machineInformation.Model}'");
Log.Instance.Trace($" * BIOS: '{machineInformation.BiosVersion}'");
Log.Instance.Trace($" * BIOS: '{machineInformation.BiosVersion}' [{machineInformation.BiosVersionRaw}]");
Log.Instance.Trace($" * Properties.SupportsAlwaysOnAc: '{machineInformation.Properties.SupportsAlwaysOnAc.status}, {machineInformation.Properties.SupportsAlwaysOnAc.connectivity}'");
Log.Instance.Trace($" * Properties.SupportsGodModeV1: '{machineInformation.Properties.SupportsGodModeV1}'");
Log.Instance.Trace($" * Properties.SupportsGodModeV2: '{machineInformation.Properties.SupportsGodModeV2}'");
Expand Down Expand Up @@ -222,7 +223,7 @@ private static async Task<bool> GetSupportsIntelligentSubModeAsync()
return result.First();
}

private static async Task<BiosVersion?> GetBIOSVersionAsync()
private static async Task<(BiosVersion?, string?)> GetBIOSVersionAsync()
{
var result = await WMI.ReadAsync("root\\CIMV2",
$"SELECT * FROM Win32_BIOS",
Expand All @@ -236,9 +237,9 @@ private static async Task<bool> GetSupportsIntelligentSubModeAsync()
var versionString = versionRegex.Match(biosString).Value;

if (!int.TryParse(versionRegex.Match(versionString).Value, out var version))
return null;
return (null, null);

return new(prefix, version);
return (new(prefix, version), biosString);
}

private static bool GetHasQuietToPerformanceModeSwitchingBug(BiosVersion? biosVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private async Task RefreshAsync(bool forceRefresh = false)
_modelLabel.Content = mi.Model;
_mtmLabel.Content = mi.MachineType;
_serialNumberLabel.Content = mi.SerialNumber;
_biosLabel.Content = mi.BiosVersion;
_biosLabel.Content = mi.BiosVersionRaw;

try
{
Expand Down

0 comments on commit b034f2b

Please sign in to comment.