Files
laatzen/Common/Ui/GenesisToolBox/Infrastructure/ApplicationVersion.cs
T

45 lines
1.3 KiB
C#

namespace Xylem.Common.Ui.GenesisToolBox.Infrastructure
{
using System;
using System.Reflection;
internal struct ApplicationVersion
{
private ApplicationVersion(bool initialize)
{
if (initialize)
{
this.Assembly = System.Reflection.Assembly
.GetExecutingAssembly()
.GetName();
this.Major = this.Assembly.Version.Major;
this.Minor = this.Assembly.Version.Minor;
this.Build = this.Assembly.Version.Build;
}
else
{
this.Major = default(int);
this.Minor = default(int);
this.Build = default(int);
this.Assembly = default(AssemblyName);
}
}
public int Major { get; }
public int Minor { get; }
public int Build { get; }
public AssemblyName Assembly { get; }
public override string ToString()
=> $"{nameof(Version)}: {this.Major}.{this.Minor}.{this.Build}";
public static ApplicationVersion Current => new ApplicationVersion(true);
public static implicit operator string(ApplicationVersion assemblyVersion)
=> assemblyVersion.ToString();
}
}