public ReleaseResource GetRelease(ProjectResource project, SemanticVersion version) { if (_cache.TryGetValue(CacheKey(CacheKeyType.Release, project.Id, version.ToNormalizedString()), out ReleaseResource release)) { return(release); } TrackCacheEvent(CacheKeyType.Release, project.Id + ";" + version.ToNormalizedString()); return(ListReleases(project).SingleOrDefault(package => { var packageVesion = package.Version.ToSemanticVersion(); return string.Equals(version.ToOriginalString(), packageVesion.ToOriginalString(), StringComparison.OrdinalIgnoreCase) || string.Equals(version.ToNormalizedString(), packageVesion.ToNormalizedString(), StringComparison.OrdinalIgnoreCase) || string.Equals(version.ToFullString(), packageVesion.ToFullString(), StringComparison.OrdinalIgnoreCase); })); }
public static bool IsSemVer2(this SemanticVersion v) { return(NuGetVersion.Parse(v.ToFullString()).IsSemVer2); }