BizHawk/Version/VersionInfo.cs

49 lines
1.3 KiB
C#
Raw Normal View History

#nullable disable
using System.IO;
2020-02-26 21:33:50 +00:00
using System.Reflection;
2017-04-27 16:30:22 +00:00
internal static class VersionInfo
{
// keep this updated at every major release
2020-02-26 21:33:50 +00:00
public const string MainVersion = "2.4.0"; // Use numbers only or the new version notification won't work
public const string ReleaseDate = "January 18, 2020";
public const string HomePage = "http://tasvideos.org/BizHawk.html";
2019-10-27 15:35:29 +00:00
public static readonly bool DeveloperBuild = true;
public static readonly string CustomBuildString;
public static string GetEmuVersion()
{
2020-02-26 21:33:50 +00:00
return DeveloperBuild
? "GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH
: "Version " + MainVersion;
}
static VersionInfo()
{
2017-04-24 12:41:55 +00:00
string path = Path.Combine(GetExeDirectoryAbsolute(), "dll");
path = Path.Combine(path, "custombuild.txt");
if (File.Exists(path))
{
var lines = File.ReadAllLines(path);
if (lines.Length > 0)
2017-04-27 16:30:22 +00:00
{
CustomBuildString = lines[0];
2017-04-27 16:30:22 +00:00
}
}
}
// code copied to avoid depending on code in other projects
2017-04-27 16:30:22 +00:00
private static string GetExeDirectoryAbsolute()
{
2020-02-26 21:33:50 +00:00
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) ?? "";
if (path.EndsWith(Path.DirectorySeparatorChar.ToString()))
2017-04-27 16:30:22 +00:00
{
path = path.Remove(path.Length - 1, 1);
2017-04-27 16:30:22 +00:00
}
return path;
}
2015-12-20 20:44:50 +00:00
}