Skip to content

Commit d1f4f88

Browse files
Add function to get revision
1 parent 2bba75b commit d1f4f88

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private static string CreateExceptionReport(System.Exception ex)
6262
sb.AppendLine($"* Command Line: {Environment.CommandLine}");
6363
sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
6464
sb.AppendLine($"* Flow Launcher version: {Constant.Version}");
65-
sb.AppendLine($"* OS Version: {GetWindowsBuildVersionFromRegistry()}");
65+
sb.AppendLine($"* OS Version: {GetWindowsFullVersionFromRegistry()}");
6666
sb.AppendLine($"* IntPtr Length: {IntPtr.Size}");
6767
sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}");
6868
sb.AppendLine($"* Python Path: {Constant.PythonPath}");
@@ -172,13 +172,14 @@ private static List<string> GetFrameworkVersionFromRegistry()
172172
}
173173

174174
}
175-
public static string GetWindowsBuildVersionFromRegistry()
175+
176+
public static string GetWindowsFullVersionFromRegistry()
176177
{
177178
try
178179
{
179180
using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
180181
{
181-
var buildRevision = registryKey.GetValue("UBR").ToString();
182+
var buildRevision = GetWindowsRevisionFromRegistry();
182183
var currentBuild = registryKey.GetValue("CurrentBuild").ToString();
183184
return currentBuild + "." + buildRevision;
184185
}
@@ -188,5 +189,21 @@ public static string GetWindowsBuildVersionFromRegistry()
188189
return Environment.OSVersion.VersionString;
189190
}
190191
}
192+
193+
public static string GetWindowsRevisionFromRegistry()
194+
{
195+
try
196+
{
197+
using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
198+
{
199+
var buildRevision = registryKey.GetValue("UBR").ToString();
200+
return buildRevision;
201+
}
202+
}
203+
catch
204+
{
205+
return "0";
206+
}
207+
}
191208
}
192209
}

Flow.Launcher/Helper/ErrorReporting.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void DispatcherUnhandledException(object sender, DispatcherUnhandl
3333
public static string RuntimeInfo()
3434
{
3535
var info = $"\nFlow Launcher version: {Constant.Version}" +
36-
$"\nOS Version: {ExceptionFormatter.GetWindowsBuildVersionFromRegistry()}" +
36+
$"\nOS Version: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}" +
3737
$"\nIntPtr Length: {IntPtr.Size}" +
3838
$"\nx64: {Environment.Is64BitOperatingSystem}";
3939
return info;

0 commit comments

Comments
 (0)