Skip to content

Commit

Permalink
Updated bios versions comparison
Browse files Browse the repository at this point in the history
BartoszCichecki committed Jun 24, 2023
1 parent 0df7a14 commit 223c422
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions LenovoLegionToolkit.Lib/Structs.cs
Original file line number Diff line number Diff line change
@@ -50,6 +50,17 @@ public bool IsHigherOrEqualThan(BiosVersion other)
return Version >= other.Version;
}

public bool IsLowerThan(BiosVersion other)
{
if (!Prefix.Equals(other.Prefix, StringComparison.InvariantCultureIgnoreCase))
return false;

if (Version is null || other.Version is null)
return true;

return Version < other.Version;
}

public override string ToString() => $"{nameof(Prefix)}: {Prefix}, {nameof(Version)}: {Version}";
}

2 changes: 1 addition & 1 deletion LenovoLegionToolkit.Lib/Utils/Compatibility.cs
Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ private static bool GetIsExcludedFromLenovoLighting(BiosVersion? biosVersion)
new("GKCN", 54)
};

return affectedBiosVersions.Any(bv => biosVersion?.IsHigherOrEqualThan(bv) ?? false);
return affectedBiosVersions.Any(bv => biosVersion?.IsLowerThan(bv) ?? false);
}

private static bool GetIsExcludedFromPanelLenovoLighting(string machineType, string model)

0 comments on commit 223c422

Please sign in to comment.