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

Treat AVC min without max as open range #2571

Merged
merged 1 commit into from
Nov 14, 2018
Merged
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
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