44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
namespace Xylem.Common.Ui.GenesisToolBox.Infrastructure
|
|
{
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
internal struct SoftwareVersion
|
|
{
|
|
private SoftwareVersion(bool initialize)
|
|
{
|
|
this.AssemblyName = Assembly
|
|
.GetExecutingAssembly()
|
|
.GetName();
|
|
this.Name = this.AssemblyName.Name;
|
|
|
|
var version = this.AssemblyName.Version;
|
|
|
|
this.MajorV = version.Major;
|
|
this.MinorV = version.Minor;
|
|
this.BuildV = version.Build;
|
|
this.VersionString = $"{this.MajorV}.{this.MinorV}.{this.BuildV}";
|
|
}
|
|
|
|
public string Name { get; internal set; }
|
|
|
|
public int MajorV { get; internal set; }
|
|
|
|
public int MinorV { get; internal set; }
|
|
|
|
public int BuildV { get; internal set; }
|
|
|
|
public string VersionString { get; }
|
|
|
|
public AssemblyName AssemblyName { get; }
|
|
|
|
public override string ToString()
|
|
=> $"{nameof(Version)}: {this.VersionString}";
|
|
|
|
public static SoftwareVersion Current = new SoftwareVersion(true);
|
|
|
|
public static implicit operator string(SoftwareVersion assemblyVersion)
|
|
=> assemblyVersion.ToString();
|
|
}
|
|
}
|