public bool Equals(SemanticVersion other) { return(!Object.ReferenceEquals(null, other) && Version.Equals(other.Version) && PackageReleaseVersion.Equals(other.PackageReleaseVersion) && SpecialVersion.Equals(other.SpecialVersion, StringComparison.OrdinalIgnoreCase)); }
public bool Equals(SemanticVersion other) { return(!Object.ReferenceEquals(null, other) && Version.Equals(other.Version) && SpecialVersion.Equals(other.SpecialVersion, StringComparison.OrdinalIgnoreCase) && IsSnapshot == other.IsSnapshot); }
public override int GetHashCode() { unchecked { return(((Version?.GetHashCode() ?? 0) * 397) ^ (SpecialVersion?.GetHashCode() ?? 0)); } }
public override int GetHashCode() { int hashCode = Version.GetHashCode(); if (SpecialVersion != null) { hashCode = hashCode * 4567 + SpecialVersion.GetHashCode(); } return(hashCode); }
public bool EqualsSnapshot(SemanticVersion seekingVersion) { if (seekingVersion.IsSnapshot) { return(Version == seekingVersion.Version && SpecialVersion.StartsWith(seekingVersion.SpecialVersion, StringComparison.OrdinalIgnoreCase)); } else { return(Equals(this, seekingVersion)); } }
public override int GetHashCode() { int hashCode = Version.GetHashCode(); if (SpecialVersion != null) { hashCode = hashCode * 4567 + SpecialVersion.GetHashCode(); } if (PackageReleaseVersion != 0) { hashCode = hashCode * 123 + PackageReleaseVersion.GetHashCode(); } return(hashCode); }
public int CompareTo(SemanticVersion other) { if (Object.ReferenceEquals(other, null)) { return(1); } int result = Version.CompareTo(other.Version); if (result != 0) { return(result); } bool empty = String.IsNullOrEmpty(SpecialVersion); bool otherEmpty = String.IsNullOrEmpty(other.SpecialVersion); if (empty && otherEmpty) { return(0); } else if (empty) { return(1); } else if (otherEmpty) { return(-1); } // Compare the release labels using SemVer 2.0.0 comparision rules. var releaseLabels = SpecialVersion.Split('.'); var otherReleaseLabels = other.SpecialVersion.Split('.'); return(CompareReleaseLabels(releaseLabels, otherReleaseLabels)); }
/// <summary> /// True if the version contains metadata or multiple release labels. /// </summary> public bool IsSemVer2() { return(!string.IsNullOrEmpty(Metadata) || (!string.IsNullOrEmpty(SpecialVersion) && SpecialVersion.Contains("."))); }