2013-06-28 00:04:52 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2017-01-04 20:41:50 +00:00
|
|
|
|
using System.Linq;
|
2013-06-28 00:04:52 +00:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.EnvironmentInfo
|
|
|
|
|
{
|
|
|
|
|
public static class BuildInfo
|
|
|
|
|
{
|
2017-01-04 20:41:50 +00:00
|
|
|
|
static BuildInfo()
|
|
|
|
|
{
|
|
|
|
|
var assembly = Assembly.GetExecutingAssembly();
|
|
|
|
|
|
|
|
|
|
Version = assembly.GetName().Version;
|
|
|
|
|
|
|
|
|
|
var attributes = assembly.GetCustomAttributes(true);
|
|
|
|
|
|
2019-08-22 21:28:51 +00:00
|
|
|
|
Branch = "unknown";
|
2017-01-04 20:41:50 +00:00
|
|
|
|
|
|
|
|
|
var config = attributes.OfType<AssemblyConfigurationAttribute>().FirstOrDefault();
|
|
|
|
|
if (config != null)
|
|
|
|
|
{
|
|
|
|
|
Branch = config.Configuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Release = $"{Version}-{Branch}";
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-24 20:43:33 +00:00
|
|
|
|
public static string AppName { get; } = "Lidarr";
|
|
|
|
|
|
2017-01-04 20:41:50 +00:00
|
|
|
|
public static Version Version { get; }
|
2020-01-03 12:49:24 +00:00
|
|
|
|
public static string Branch { get; }
|
2017-01-04 20:41:50 +00:00
|
|
|
|
public static string Release { get; }
|
2013-06-28 00:04:52 +00:00
|
|
|
|
|
|
|
|
|
public static DateTime BuildDateTime
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var fileLocation = Assembly.GetCallingAssembly().Location;
|
|
|
|
|
return new FileInfo(fileLocation).LastWriteTimeUtc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsDebug
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
#if DEBUG
|
|
|
|
|
return true;
|
|
|
|
|
#else
|
|
|
|
|
return false;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-22 21:28:51 +00:00
|
|
|
|
}
|