26 lines
807 B
C#
26 lines
807 B
C#
using System.Reflection;
|
|
|
|
namespace Pilz;
|
|
|
|
[AttributeUsage(AttributeTargets.Assembly)]
|
|
public class AssemblyAppVersionAttribute : Attribute
|
|
{
|
|
public const string EntryAssemblyVersionKey = "{EntryAssemblyVersion}";
|
|
|
|
public AppVersion Version { get; }
|
|
|
|
public AssemblyAppVersionAttribute(string version, int build, AppChannel channel)
|
|
{
|
|
if (version.Contains(EntryAssemblyVersionKey))
|
|
version = version.Replace(EntryAssemblyVersionKey, Assembly.GetEntryAssembly().GetName().Version.ToString());
|
|
Version = new(new Version(version), build, channel);
|
|
}
|
|
|
|
public AssemblyAppVersionAttribute(string version) : this(version, 1)
|
|
{
|
|
}
|
|
|
|
public AssemblyAppVersionAttribute(string version, int build) : this(version, build, AppChannel.Stable)
|
|
{
|
|
}
|
|
} |