From b5c8bf683f94790a29ba733e96dd39cdf6cccc2b Mon Sep 17 00:00:00 2001 From: ORelio Date: Mon, 28 May 2018 20:54:58 +0200 Subject: [PATCH] Add build info inside MCC executable Should help when submitting bug reports. See #456. --- MinecraftClient/Program.cs | 23 +++++++++++++++++++++- MinecraftClient/Properties/AssemblyInfo.cs | 18 +++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 5281ffed..f59ea8e0 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -21,9 +21,10 @@ namespace MinecraftClient private static McTcpClient Client; public static string[] startupargs; - public const string Version = "1.12.2 DEV"; + public const string Version = MCHighestVersion; public const string MCLowestVersion = "1.4.6"; public const string MCHighestVersion = "1.12.2"; + public static readonly string BuildInfo = null; private static Thread offlinePrompt = null; private static bool useMcVersionOnce = false; @@ -35,6 +36,12 @@ namespace MinecraftClient { Console.WriteLine("Console Client for MC {0} to {1} - v{2} - By ORelio & Contributors", MCLowestVersion, MCHighestVersion, Version); + //Build information to facilitate processing of bug reports + if (BuildInfo != null) + { + ConsoleIO.WriteLineFormatted("§8" + BuildInfo); + } + //Debug input ? if (args.Length == 1 && args[0] == "--keyboard-debug") { @@ -421,5 +428,19 @@ namespace MinecraftClient if (assembly == null) { assembly = Assembly.GetExecutingAssembly(); } return assembly.GetTypes().Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)).ToArray(); } + + /// + /// Static initialization of build information, read from assembly information + /// + static Program() + { + AssemblyConfigurationAttribute attribute + = typeof(Program) + .Assembly + .GetCustomAttributes(typeof(System.Reflection.AssemblyConfigurationAttribute), false) + .FirstOrDefault() as AssemblyConfigurationAttribute; + if (attribute != null) + BuildInfo = attribute.Configuration; + } } } diff --git a/MinecraftClient/Properties/AssemblyInfo.cs b/MinecraftClient/Properties/AssemblyInfo.cs index debc466e..604bed7a 100644 --- a/MinecraftClient/Properties/AssemblyInfo.cs +++ b/MinecraftClient/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Minecraft Console Client")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyDescription("Lightweight console for Minecraft chat and automated scripts")] +//[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("https://github.com/ORelio/Minecraft-Console-Client")] [assembly: AssemblyProduct("MinecraftClient")] -[assembly: AssemblyCopyright("Copyright © ORelio 2012-2014")] +[assembly: AssemblyCopyright("Copyright © 2012-2018 ORelio & Contributors")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,11 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.0")] -[assembly: AssemblyFileVersion("1.8.0")] +// [assembly: AssemblyVersion("1.0.0")] +// [assembly: AssemblyFileVersion("1.0.0")] + +// AppVeyor Build Number +// MCC will use the following command as CMD pre-build script in AppVeyor msbuild settings: +// echo [assembly: AssemblyConfiguration("AppVeyor build %APPVEYOR_BUILD_NUMBER%, built on %DATE% from commit %APPVEYOR_REPO_COMMIT:~0,7%")] >> MinecraftClient\Properties\AssemblyInfo.cs +// The command will add build info like the example below to be incorporated in Assembly Info in order to display build info on launch +// [assembly: AssemblyConfiguration("AppVeyor build 1234, built on Sun 31/12/2017 from commit abc1def")] \ No newline at end of file