public ReleaseResource GetRelease(ProjectResource project, SemanticVersion semver) { var version = semver.ToNormalizedString(); if (_cache.TryGetValue(CacheKey(CacheKeyType.Release, project.Id, version), out ReleaseResource release)) { return(release); } return(ListReleases(project).SingleOrDefault(package => string.Equals(version, package.Version.ToSemanticVersion().ToNormalizedString(), StringComparison.OrdinalIgnoreCase) || string.Equals(semver.ToOriginalString(), package.Version, StringComparison.OrdinalIgnoreCase))); }
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); })); }