Пример #1
0
 /// <summary>
 /// Builds a standard Informational version string.
 /// </summary>
 /// <param name="version">The version. Must not be null nor invalid.</param>
 /// <param name="commitSha">The SHA1 of the commit (must be 40 hex digits).</param>
 /// <param name="commitDateUtc">The commit date (must be in UTC).</param>
 /// <returns>The informational version.</returns>
 static public string BuildInformationalVersion(SVersion version, string commitSha, DateTime commitDateUtc)
 {
     if (version == null || !version.IsValid)
     {
         throw new ArgumentException(nameof(version));
     }
     if (commitSha == null || commitSha.Length != 40 || !commitSha.All(IsHexDigit))
     {
         throw new ArgumentException("Must be a 40 hex digits string.", nameof(commitSha));
     }
     if (commitDateUtc.Kind != DateTimeKind.Utc)
     {
         throw new ArgumentException("Must be a UTC date.", nameof(commitDateUtc));
     }
     return($"{version.ToNormalizedString()}/{commitSha}/{commitDateUtc:u}");
 }