(61d00a474) v0.9.7.1
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
public static class AssemblyInfo
|
||||
{
|
||||
/// <summary> Gets the git hash value from the assembly
|
||||
/// or null if it cannot be found. </summary>
|
||||
public static string GetGitRevision()
|
||||
{
|
||||
var asm = typeof(AssemblyInfo).Assembly;
|
||||
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
|
||||
return attrs.FirstOrDefault(a => a.Key == "GitRevision")?.Value;
|
||||
}
|
||||
|
||||
/// <summary> Gets the git branch name from the assembly
|
||||
/// or null if it cannot be found. </summary>
|
||||
public static string GetGitBranch()
|
||||
{
|
||||
var asm = typeof(AssemblyInfo).Assembly;
|
||||
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
|
||||
return attrs.FirstOrDefault(a => a.Key == "GitBranch")?.Value;
|
||||
}
|
||||
|
||||
/// <summary> Gets the build platform and configuration </summary>
|
||||
public static string GetBuildString()
|
||||
{
|
||||
string retVal = "Unknown";
|
||||
#if WINDOWS
|
||||
retVal = "Windows";
|
||||
#elif OSX
|
||||
retVal = "Mac";
|
||||
#elif LINUX
|
||||
retVal = "Linux";
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
retVal = "Debug" + retVal;
|
||||
#elif UNSTABLE
|
||||
retVal = "Unstable" + retVal;
|
||||
#else
|
||||
retVal = "Release" + retVal;
|
||||
#endif
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user