diff --git a/SabreTools.Core/Globals.cs b/SabreTools.Core/Globals.cs index f519e0fb..fe4c9436 100644 --- a/SabreTools.Core/Globals.cs +++ b/SabreTools.Core/Globals.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; #if NET452_OR_GREATER || NETCOREAPP using System.Threading.Tasks; #endif @@ -10,7 +11,10 @@ namespace SabreTools.Core /// public class Globals { - #region Public accessors + /// + /// The current toolset version to be used by all child applications + /// + public readonly static string? Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString(); /// /// Maximum threads to use during parallel operations @@ -26,7 +30,5 @@ namespace SabreTools.Core MaxDegreeOfParallelism = MaxThreads }; #endif - - #endregion } } diff --git a/SabreTools.Core/Prepare.cs b/SabreTools.Core/Prepare.cs index 4d5b8cb7..f87c7884 100644 --- a/SabreTools.Core/Prepare.cs +++ b/SabreTools.Core/Prepare.cs @@ -1,6 +1,4 @@ using System; -using System.IO; -using System.Reflection; namespace SabreTools.Core { @@ -9,11 +7,6 @@ namespace SabreTools.Core /// public static class Prepare { - /// - /// The current toolset version to be used by all child applications - /// - public readonly static string Version = $"v1.1.2"; - /// /// Readies the console and outputs the header /// @@ -23,7 +16,7 @@ namespace SabreTools.Core // Dynamically create the header string, adapted from http://stackoverflow.com/questions/8200661/how-to-align-string-in-fixed-length-string int width = Console.WindowWidth - 3; string border = $"+{new string('-', width)}+"; - string mid = $"{program} {Version}"; + string mid = $"{program} {Globals.Version}"; mid = $"|{mid.PadLeft(((width - mid.Length) / 2) + mid.Length).PadRight(width)}|"; // If we're outputting to console, do fancy things @@ -36,7 +29,7 @@ namespace SabreTools.Core Console.ForegroundColor = ConsoleColor.Yellow; Console.BackgroundColor = ConsoleColor.Blue; - Console.Title = $"{program} {Version}"; + Console.Title = $"{program} {Globals.Version}"; // Output the header Console.WriteLine(border);