diff --git a/src/modules/espresso/Espresso.Shell/Core/APIHelper.cs b/src/modules/espresso/Espresso.Shell/Core/APIHelper.cs index 824a492e16..16f72bee5a 100644 --- a/src/modules/espresso/Espresso.Shell/Core/APIHelper.cs +++ b/src/modules/espresso/Espresso.Shell/Core/APIHelper.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.Win32; using NLog; using System; using System.Runtime.InteropServices; @@ -25,6 +26,8 @@ namespace Espresso.Shell.Core /// public class APIHelper { + private const string BUILD_REGISTRY_LOCATION = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion"; + private static CancellationTokenSource TokenSource = new CancellationTokenSource(); private static CancellationToken ThreadToken; @@ -154,5 +157,21 @@ namespace Espresso.Shell.Core return success; } } + + public static string GetOperatingSystemBuild() + { + try + { + RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BUILD_REGISTRY_LOCATION); + + var versionString = $"{registryKey.GetValue("ProductName")} {registryKey.GetValue("DisplayVersion")} {registryKey.GetValue("BuildLabEx")}"; + return versionString; + } + catch (Exception ex) + { + log.Debug($"Could not get registry key for the build number. Error: {ex.Message}"); + return string.Empty; + } + } } } diff --git a/src/modules/espresso/Espresso.Shell/Espresso.Shell.csproj b/src/modules/espresso/Espresso.Shell/Espresso.Shell.csproj index 1fbdc1b64c..04aba56431 100644 --- a/src/modules/espresso/Espresso.Shell/Espresso.Shell.csproj +++ b/src/modules/espresso/Espresso.Shell/Espresso.Shell.csproj @@ -6,6 +6,7 @@ + diff --git a/src/modules/espresso/Espresso.Shell/Program.cs b/src/modules/espresso/Espresso.Shell/Program.cs index 5be5ca5929..2211dc1a55 100644 --- a/src/modules/espresso/Espresso.Shell/Program.cs +++ b/src/modules/espresso/Espresso.Shell/Program.cs @@ -42,6 +42,8 @@ namespace Espresso.Shell log.Info("Launching Espresso..."); log.Info(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion); + log.Debug($"OS: {Environment.OSVersion}"); + log.Debug($"OS Build: {APIHelper.GetOperatingSystemBuild()}"); var configOption = new Option( aliases: new[] { "--config", "-c" }, @@ -106,6 +108,7 @@ namespace Espresso.Shell private static void HandleCommandLineArguments(string config, bool displayOn, long timeLimit) { + log.Info($"The value for --config is: {config}"); log.Info($"The value for --display-on is: {displayOn}"); log.Info($"The value for --time-limit is: {timeLimit}"); @@ -251,9 +254,10 @@ namespace Espresso.Shell } catch (Exception ex) { - var errorMessage = $"There was a problem reading the configuration file.\n{ex.Message}"; + var errorMessage = $"There was a problem reading the configuration file. Error: {ex.Message}"; log.Info(errorMessage); log.Debug(errorMessage); + log.Debug($"Configuration path: {fullPath}"); } }