Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comparison of 1.0.0 to 1.0 #2817

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Core/Types/GameComparator/StrictGameComparator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CKAN.Versioning;
using System;
using log4net;
using CKAN.Versioning;

namespace CKAN
{
Expand All @@ -23,15 +24,16 @@ public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule
{
if (module.ksp_version_min != null && module.ksp_version_max != null)
{
if (module.ksp_version_min <= module.ksp_version_max)
var minRange = module.ksp_version_min.ToVersionRange();
var maxRange = module.ksp_version_max.ToVersionRange();
if (minRange.Lower.Value <= maxRange.Upper.Value)
{
var minRange = module.ksp_version_min.ToVersionRange();
var maxRange = module.ksp_version_max.ToVersionRange();

moduleRange = new KspVersionRange(minRange.Lower, maxRange.Upper);
}
else
{
log.WarnFormat("{0} is not less or equal to {1}",
module.ksp_version_min, module.ksp_version_max);
return false;
}
}
Expand All @@ -55,5 +57,7 @@ public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule

return gameVersionRange.IntersectWith(moduleRange) != null;
}

private static readonly ILog log = LogManager.GetLogger(typeof(StrictGameComparator));
}
}
2 changes: 1 addition & 1 deletion Netkan/Transformers/AvcTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static void ApplyVersions(JObject json, AvcVersion avc)
if (kspMin != null && kspMax != null)
{
// If we have both a minimum and maximum KSP version...
if (kspMin.CompareTo(kspMax) == 0)
if (kspMin.Equals(kspMax))
{
// ...and they are equal, then just set ksp_version
json["ksp_version"] = kspMin.ToString();
Expand Down