c756479239
* Fix mod SptVersion to be a range - SptVersion and ModDependencies now use a Range instead of a set version - Remove IsValid and IsValidRange checks from ModValidator, as invalid values will fail to parse into the strong types before this method is called - Remove unused "AnySatisfies" and "IsValid*" methods from ISemVer - Update TestMod to use Range types * Formatting --------- Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
34 lines
954 B
C#
34 lines
954 B
C#
using Range = SemanticVersioning.Range;
|
|
using Version = SemanticVersioning.Version;
|
|
|
|
namespace SPTarkov.Common.Semver.Implementations;
|
|
|
|
public class SemanticVersioningSemVer : ISemVer
|
|
{
|
|
public string MaxSatisfying(List<Version> versions)
|
|
{
|
|
return MaxSatisfying(versions.AsEnumerable());
|
|
}
|
|
|
|
public string MaxSatisfying(IEnumerable<Version> versions)
|
|
{
|
|
return MaxSatisfying("*", versions);
|
|
}
|
|
|
|
public string MaxSatisfying(string version, List<Version> versions)
|
|
{
|
|
return MaxSatisfying(version, versions.AsEnumerable());
|
|
}
|
|
|
|
public string MaxSatisfying(string version, IEnumerable<Version> versions)
|
|
{
|
|
var versionRanges = versions.Select(versionInner => versionInner.ToString());
|
|
return Range.MaxSatisfying(version, versionRanges, true);
|
|
}
|
|
|
|
public bool Satisfies(Version version, Range testRange)
|
|
{
|
|
return testRange.IsSatisfied(version, true);
|
|
}
|
|
}
|