cscz/cscz/Utilities.cs

31 lines
596 B
C#

using System;
using System.Reflection;
using SBRLUtilities;
namespace cscz
{
public static class Utilities
{
public static string GetFullHash()
{
string hash = EmbeddedFiles.ReadAllText("cscz.git-hash.txt").Trim();
if (hash == string.Empty)
hash = new string('?', 40);
return hash;
}
public static string GetShortHash()
{
return GetFullHash().Substring(0, 7);
}
public static string GetVersionText()
{
Version asmVersion = Assembly.GetCallingAssembly().GetName().Version;
return $"v{asmVersion.Major}.{asmVersion.Minor}-{GetShortHash()}";
}
}
}