Skip to content

Commit

Permalink
Merge #2571 Treat AVC min without max as open range
Browse files Browse the repository at this point in the history
  • Loading branch information
politas committed Nov 14, 2018
2 parents e23bdb6 + 5b6f1c0 commit 9ca5e37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ All notable changes to this project will be documented in this file.
- [Core] Purge 5.5 MB of bloat from `registry.json` (#2179 by: HebaruSan; reviewed: Olympic1)
- [GUI] Allow uninstallation of conflicting mods (#2561 by: HebaruSan; reviewed: Olympic1)
- [Core] Cache listings of legacy cache dirs (#2563 by: HebaruSan; reviewed: politas)
- [Netkan] Treat AVC min without max as open range (#2571 by: HebaruSan; reviewed: politas)

## v1.25.3 (Woomera)

Expand Down
20 changes: 17 additions & 3 deletions Netkan/Transformers/AvcTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,23 @@ public static void ApplyVersions(JObject json, AvcVersion avc)
var existingKspMax = existingKspMaxStr == null ? null : KspVersion.Parse(existingKspMaxStr);

// Get the minimum and maximum KSP versions that are in the AVC file.
// Use specific KSP version if min/max don't exist.
var avcKspMin = avc.ksp_version_min ?? avc.ksp_version;
var avcKspMax = avc.ksp_version_max ?? avc.ksp_version;
// http://ksp.cybutek.net/kspavc/Documents/README.htm
// KSP-AVC allows (requires?) KSP_VERSION to be set
// when KSP_VERSION_MIN/_MAX are set, but CKAN treats
// its equivalent properties as mutually exclusive.
// Only fallback if neither min nor max are defined,
// for open ranges.
KspVersion avcKspMin, avcKspMax;
if (avc.ksp_version_min == null && avc.ksp_version_max == null)
{
// Use specific KSP version if min/max don't exist
avcKspMin = avcKspMax = avc.ksp_version;
}
else
{
avcKspMin = avc.ksp_version_min;
avcKspMax = avc.ksp_version_max;
}

// Now calculate the minimum and maximum KSP versions between both the existing metadata and the
// AVC file.
Expand Down

0 comments on commit 9ca5e37

Please sign in to comment.