32 lines
841 B
C#
32 lines
841 B
C#
using System.Reflection;
|
|
|
|
namespace skyscraper8;
|
|
|
|
public class VersionInfo
|
|
{
|
|
private const int PUBLIC_RELEASE = 14;
|
|
|
|
public static int GetPublicReleaseNumber()
|
|
{
|
|
return PUBLIC_RELEASE;
|
|
}
|
|
|
|
public static string GetCurrentAssemblyDisplayVersion()
|
|
{
|
|
try
|
|
{
|
|
Assembly executingAssembly = typeof(VersionInfo).GetTypeInfo().Assembly;
|
|
AssemblyName assemblyName = executingAssembly.GetName();
|
|
Version version = assemblyName.Version;
|
|
DateTime buildDate = new DateTime(2000, 1, 1)
|
|
.AddDays(version.Build).AddSeconds(version.Revision * 2);
|
|
string displayableVersion = $"{version} ({buildDate})";
|
|
return displayableVersion;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return "???";
|
|
}
|
|
}
|
|
}
|