You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using StartsWith for version comparison is unreliable and could lead to false positives. For example, version '1.0' would incorrectly match file version '1.0.1.2' or '1.00.0'. Consider using System.Version for proper semantic version comparison or exact string matching.Β #54
Using StartsWith for version comparison is unreliable and could lead to false positives. For example, version '1.0' would incorrectly match file version '1.0.1.2' or '1.00.0'. Consider using System.Version for proper semantic version comparison or exact string matching.
// Compare versions component-wise for leniency, but avoid false positives
if (Version.TryParse(plugin.Version, out var expectedVersion) && Version.TryParse(fileVersion, out var actualVersion))
{
// Compare only as many components as are present in plugin.Version
bool matches = true;
if (expectedVersion.Major != actualVersion.Major) matches = false;
if (expectedVersion.Minor != -1 && expectedVersion.Minor != actualVersion.Minor) matches = false;
if (expectedVersion.Build != -1 && expectedVersion.Build != actualVersion.Build) matches = false;
if (expectedVersion.Revision != -1 && expectedVersion.Revision != actualVersion.Revision) matches = false;
if (matches)
{
return true;
}
}
else
{
// Fallback: exact string match
if (fileVersion == plugin.Version)
{
return true;
}
}