Skip to content

Commit 803633f

Browse files
Merge pull request #2072 from VictoriousRaptor/PrintWindowsBuildNumber
Print windows build number in log
2 parents 1ee7110 + 75dfb62 commit 803633f

File tree

5 files changed

+41
-14
lines changed

5 files changed

+41
-14
lines changed

Flow.Launcher.Infrastructure/Constant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static class Constant
1919
public static readonly string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
2020

2121
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
22-
public const string Issue = "https://github.com/Flow-Launcher/Flow.Launcher/issues/new/choose";
22+
public const string IssuesUrl = "https://github.com/Flow-Launcher/Flow.Launcher/issues";
2323
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
2424
public static readonly string Dev = "Dev";
2525
public const string Documentation = "https://flowlauncher.com/docs/#/usage-tips";

Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Globalization;
44
using System.Linq;
55
using System.Text;
6-
using System.Xml;
76
using Microsoft.Win32;
87

98
namespace Flow.Launcher.Infrastructure.Exception
@@ -63,7 +62,7 @@ private static string CreateExceptionReport(System.Exception ex)
6362
sb.AppendLine($"* Command Line: {Environment.CommandLine}");
6463
sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
6564
sb.AppendLine($"* Flow Launcher version: {Constant.Version}");
66-
sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
65+
sb.AppendLine($"* OS Version: {GetWindowsFullVersionFromRegistry()}");
6766
sb.AppendLine($"* IntPtr Length: {IntPtr.Size}");
6867
sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}");
6968
sb.AppendLine($"* Python Path: {Constant.PythonPath}");
@@ -173,5 +172,35 @@ private static List<string> GetFrameworkVersionFromRegistry()
173172
}
174173

175174
}
175+
176+
public static string GetWindowsFullVersionFromRegistry()
177+
{
178+
try
179+
{
180+
var buildRevision = GetWindowsRevisionFromRegistry();
181+
var currentBuild = Environment.OSVersion.Version.Build;
182+
return currentBuild.ToString() + "." + buildRevision;
183+
}
184+
catch
185+
{
186+
return Environment.OSVersion.VersionString;
187+
}
188+
}
189+
190+
public static string GetWindowsRevisionFromRegistry()
191+
{
192+
try
193+
{
194+
using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
195+
{
196+
var buildRevision = registryKey.GetValue("UBR").ToString();
197+
return buildRevision;
198+
}
199+
}
200+
catch
201+
{
202+
return "0";
203+
}
204+
}
176205
}
177206
}

Flow.Launcher/Helper/ErrorReporting.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
using NLog;
44
using Flow.Launcher.Infrastructure;
55
using Flow.Launcher.Infrastructure.Exception;
6-
using NLog.Fluent;
7-
using Log = Flow.Launcher.Infrastructure.Logger.Log;
86

97
namespace Flow.Launcher.Helper
108
{
@@ -31,11 +29,11 @@ public static void DispatcherUnhandledException(object sender, DispatcherUnhandl
3129
//prevent application exist, so the user can copy prompted error info
3230
e.Handled = true;
3331
}
34-
32+
3533
public static string RuntimeInfo()
3634
{
3735
var info = $"\nFlow Launcher version: {Constant.Version}" +
38-
$"\nOS Version: {Environment.OSVersion.VersionString}" +
36+
$"\nOS Version: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}" +
3937
$"\nIntPtr Length: {IntPtr.Size}" +
4038
$"\nx64: {Environment.Is64BitOperatingSystem}";
4139
return info;

Flow.Launcher/ReportWindow.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ public ReportWindow(Exception exception)
2323
SetException(exception);
2424
}
2525

26-
private static string GetIssueUrl(string website)
26+
private static string GetIssuesUrl(string website)
2727
{
2828
if (!website.StartsWith("https://github.com"))
2929
{
3030
return website;
3131
}
3232
if(website.Contains("Flow-Launcher/Flow.Launcher"))
3333
{
34-
return Constant.Issue;
34+
return Constant.IssuesUrl;
3535
}
3636
var treeIndex = website.IndexOf("tree", StringComparison.Ordinal);
37-
return treeIndex == -1 ? $"{website}/issues/new" : $"{website[..treeIndex]}/issues/new";
37+
return treeIndex == -1 ? $"{website}/issues" : $"{website[..treeIndex]}/issues";
3838
}
3939

4040
private void SetException(Exception exception)
@@ -45,8 +45,8 @@ private void SetException(Exception exception)
4545

4646
var websiteUrl = exception switch
4747
{
48-
FlowPluginException pluginException =>GetIssueUrl(pluginException.Metadata.Website),
49-
_ => Constant.Issue
48+
FlowPluginException pluginException =>GetIssuesUrl(pluginException.Metadata.Website),
49+
_ => Constant.IssuesUrl
5050
};
5151

5252

@@ -86,4 +86,4 @@ private Paragraph Hyperlink(string textBeforeUrl, string url)
8686
return paragraph;
8787
}
8888
}
89-
}
89+
}

Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
5353
{
5454
// standard UrlSourceCode format in PluginsManifest's plugins.json file: https://github.com/jjw24/Flow.Launcher.Plugin.Putty/tree/master
5555
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
56-
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues/new/choose"
56+
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues"
5757
: pluginManifestInfo.UrlSourceCode;
5858

5959
Context.API.OpenUrl(link);

0 commit comments

Comments
 (0)