Skip to content

Commit

Permalink
Merge #2817 Fix comparison of 1.0.0 to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jun 28, 2019
2 parents bf9c330 + 6a186f4 commit 30061c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ All notable changes to this project will be documented in this file.
- [Netkan] Fix http kref validation (#2811 by: HebaruSan; reviewed: DasSkelett)
- [Netkan] Fix Netkan localization parser performance (#2816 by: HebaruSan; reviewed: DasSkelett)
- [GUI] Support newlines in GUI description field (#2818 by: HebaruSan; reviewed: DasSkelett)
- [Core] Fix comparison of 1.0.0 to 1.0 (#2817 by: HebaruSan; reviewed: DasSkelett)

### Internal
- [Build] Update packages (#2775 by: Olympic1; reviewed: DasSkelett, HebaruSan)
Expand Down
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

0 comments on commit 30061c4

Please sign in to comment.