45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System;
|
|
using System.Reflection;
|
|
|
|
namespace Xylem.Common.Utils.UserAccessCtrl
|
|
{
|
|
internal struct ApplicationVersion
|
|
{
|
|
private ApplicationVersion(Boolean initialize)
|
|
{
|
|
if (initialize)
|
|
{
|
|
Assembly = System.Reflection.Assembly
|
|
.GetExecutingAssembly()
|
|
.GetName();
|
|
Major = Assembly.Version.Major;
|
|
Minor = Assembly.Version.Minor;
|
|
Build = Assembly.Version.Build;
|
|
}
|
|
else
|
|
{
|
|
Major = default(Int32);
|
|
Minor = default(Int32);
|
|
Build = default(Int32);
|
|
Assembly = default(AssemblyName);
|
|
}
|
|
}
|
|
|
|
public Int32 Major { get; }
|
|
|
|
public Int32 Minor { get; }
|
|
|
|
public Int32 Build { get; }
|
|
|
|
public AssemblyName Assembly { get; }
|
|
|
|
public override String ToString()
|
|
=> $"{nameof(Version)}: {Major}.{Minor}.{Build}";
|
|
|
|
public static ApplicationVersion Current => new ApplicationVersion(true);
|
|
|
|
public static implicit operator String(ApplicationVersion assemblyVersion)
|
|
=> assemblyVersion.ToString();
|
|
}
|
|
}
|