From 63be411f989425a3ecfbba83ad7e706841fdc224 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 6 Dec 2021 22:20:22 -0600 Subject: switch to FullVersion and SemanticVersion --- src/slskd/Program.cs | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 79c012bb..5d81c5a5 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -74,50 +74,44 @@ namespace slskd public static readonly string DefaultAppDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify), AppName); /// - /// Gets the assembly version of the application. + /// Gets the unique Id of this application invocation. /// + public static readonly Guid InvocationId = Guid.NewGuid(); + + /// + /// Gets the Id of the current application process. + /// + public static readonly int ProcessId = Environment.ProcessId; + /// /// Inaccurate when running locally. /// - public static readonly Version AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.Equals(new Version(1, 0, 0, 0)) ? new Version(0, 0, 0, 0) : Assembly.GetExecutingAssembly().GetName().Version; + private static readonly Version AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.Equals(new Version(1, 0, 0, 0)) ? new Version(0, 0, 0, 0) : Assembly.GetExecutingAssembly().GetName().Version; - /// - /// Gets the informational version of the application, including the git sha at the latest commit. - /// /// /// Inaccurate when running locally. /// - public static readonly string InformationalVersion = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion == "1.0.0" ? "0.0.0" : Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion; + private static readonly string InformationalVersion = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion == "1.0.0" ? "0.0.0" : Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion; /// - /// Gets the full application version, including both assembly and informational versions. + /// Occurs when a new log event is emitted. /// - public static readonly string FullVersion = $"{AssemblyVersion} ({InformationalVersion})"; + public static event EventHandler LogEmitted; /// /// Gets the semantic application version. /// - public static readonly string SemanticVersion = InformationalVersion.Split('-').First(); - - /// - /// Gets a value indicating whether the current version is a Canary build. - /// - public static readonly bool IsCanary = AssemblyVersion.Revision == 65534; - - /// - /// Gets the unique Id of this application invocation. - /// - public static readonly Guid InvocationId = Guid.NewGuid(); + public static string SemanticVersion => InformationalVersion.Split('-').First(); /// - /// Gets the Id of the current application process. + /// Gets the full application version, including both assembly and informational versions. /// - public static readonly int ProcessId = Environment.ProcessId; + public static string FullVersion => $"{SemanticVersion} ({InformationalVersion})"; /// - /// Occurs when a new log event is emitted. + /// Gets a value indicating whether the current version is a Canary build. /// - public static event EventHandler LogEmitted; + public static bool IsCanary => AssemblyVersion.Revision == 65534; /// /// Gets the path where application data is saved. -- cgit v1.2.3