/// <summary> /// Initializes a new instance of the <see cref="UniversalPackageVersion"/> class. /// </summary> /// <param name="major">The major version number.</param> /// <param name="minor">The minor version number.</param> /// <param name="patch">The patch number.</param> /// <param name="prerelease">The prerelease version string.</param> /// <param name="build">The build metadata.</param> public UniversalPackageVersion(BigInteger major, BigInteger minor, BigInteger patch, string prerelease, string build) { this.Major = major; this.Minor = minor; this.Patch = patch; this.Prerelease = AH.NullIf(prerelease, string.Empty); this.Build = AH.NullIf(build, string.Empty); }
/// <summary> /// Initializes a new instance of the <see cref="UniversalPackageId"/> class. /// </summary> /// <param name="group">The group of the package.</param> /// <param name="name">The name of the package.</param> /// <exception cref="ArgumentException"><paramref name="group"/> is invalid or <paramref name="name"/> is invalid.</exception> public UniversalPackageId(string group, string name) { if (!IsValidGroup(group)) { throw new ArgumentException("Invalid group."); } if (!IsValidName(name)) { throw new ArgumentException("Invalid name."); } this.Group = AH.NullIf(group, string.Empty); this.Name = name; }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member private static UniversalPackageVersion ParseInternal(string s, out string error) { var match = SemanticVersionRegex.Match(s); if (!match.Success) { error = "String is not a valid semantic version."; return(null); } var major = BigInteger.Parse(match.Groups[1].Value); var minor = BigInteger.Parse(match.Groups[2].Value); var patch = BigInteger.Parse(match.Groups[3].Value); var prerelease = AH.NullIf(match.Groups[4].Value, string.Empty); var build = AH.NullIf(match.Groups[5].Value, string.Empty); error = null; return(new UniversalPackageVersion(major, minor, patch, prerelease, build)); }
public override int GetHashCode() => AH.GetHashCode(this.bytes);
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static bool Equals(HexString s1, HexString s2) => AH.Equals(s1.bytes, s2.bytes);