From 2bba75b27a0feefe6e645f5ef60b52e71fec15b3 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 19 Apr 2023 21:07:40 +0800 Subject: [PATCH 1/5] Print windows build number in log --- .../Exception/ExceptionFormatter.cs | 19 +++++++++++++++++-- Flow.Launcher/Helper/ErrorReporting.cs | 6 ++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index 54c19c048..b853f885d 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; -using System.Xml; using Microsoft.Win32; namespace Flow.Launcher.Infrastructure.Exception @@ -63,7 +62,7 @@ namespace Flow.Launcher.Infrastructure.Exception sb.AppendLine($"* Command Line: {Environment.CommandLine}"); sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); sb.AppendLine($"* Flow Launcher version: {Constant.Version}"); - sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}"); + sb.AppendLine($"* OS Version: {GetWindowsBuildVersionFromRegistry()}"); sb.AppendLine($"* IntPtr Length: {IntPtr.Size}"); sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}"); sb.AppendLine($"* Python Path: {Constant.PythonPath}"); @@ -173,5 +172,21 @@ namespace Flow.Launcher.Infrastructure.Exception } } + public static string GetWindowsBuildVersionFromRegistry() + { + try + { + using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\")) + { + var buildRevision = registryKey.GetValue("UBR").ToString(); + var currentBuild = registryKey.GetValue("CurrentBuild").ToString(); + return currentBuild + "." + buildRevision; + } + } + catch + { + return Environment.OSVersion.VersionString; + } + } } } diff --git a/Flow.Launcher/Helper/ErrorReporting.cs b/Flow.Launcher/Helper/ErrorReporting.cs index a7ce7444c..db5a11f74 100644 --- a/Flow.Launcher/Helper/ErrorReporting.cs +++ b/Flow.Launcher/Helper/ErrorReporting.cs @@ -3,8 +3,6 @@ using System.Windows.Threading; using NLog; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Exception; -using NLog.Fluent; -using Log = Flow.Launcher.Infrastructure.Logger.Log; namespace Flow.Launcher.Helper { @@ -31,11 +29,11 @@ namespace Flow.Launcher.Helper //prevent application exist, so the user can copy prompted error info e.Handled = true; } - + public static string RuntimeInfo() { var info = $"\nFlow Launcher version: {Constant.Version}" + - $"\nOS Version: {Environment.OSVersion.VersionString}" + + $"\nOS Version: {ExceptionFormatter.GetWindowsBuildVersionFromRegistry()}" + $"\nIntPtr Length: {IntPtr.Size}" + $"\nx64: {Environment.Is64BitOperatingSystem}"; return info; From d1f4f88bc2ce233ed7bc33d5f0cf40784fb5de2a Mon Sep 17 00:00:00 2001 From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 20 Apr 2023 11:37:25 +0800 Subject: [PATCH 2/5] Add function to get revision --- .../Exception/ExceptionFormatter.cs | 23 ++++++++++++++++--- Flow.Launcher/Helper/ErrorReporting.cs | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index b853f885d..63f670c66 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -62,7 +62,7 @@ namespace Flow.Launcher.Infrastructure.Exception sb.AppendLine($"* Command Line: {Environment.CommandLine}"); sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); sb.AppendLine($"* Flow Launcher version: {Constant.Version}"); - sb.AppendLine($"* OS Version: {GetWindowsBuildVersionFromRegistry()}"); + sb.AppendLine($"* OS Version: {GetWindowsFullVersionFromRegistry()}"); sb.AppendLine($"* IntPtr Length: {IntPtr.Size}"); sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}"); sb.AppendLine($"* Python Path: {Constant.PythonPath}"); @@ -172,13 +172,14 @@ namespace Flow.Launcher.Infrastructure.Exception } } - public static string GetWindowsBuildVersionFromRegistry() + + public static string GetWindowsFullVersionFromRegistry() { try { using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\")) { - var buildRevision = registryKey.GetValue("UBR").ToString(); + var buildRevision = GetWindowsRevisionFromRegistry(); var currentBuild = registryKey.GetValue("CurrentBuild").ToString(); return currentBuild + "." + buildRevision; } @@ -188,5 +189,21 @@ namespace Flow.Launcher.Infrastructure.Exception return Environment.OSVersion.VersionString; } } + + public static string GetWindowsRevisionFromRegistry() + { + try + { + using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\")) + { + var buildRevision = registryKey.GetValue("UBR").ToString(); + return buildRevision; + } + } + catch + { + return "0"; + } + } } } diff --git a/Flow.Launcher/Helper/ErrorReporting.cs b/Flow.Launcher/Helper/ErrorReporting.cs index db5a11f74..b5da2efad 100644 --- a/Flow.Launcher/Helper/ErrorReporting.cs +++ b/Flow.Launcher/Helper/ErrorReporting.cs @@ -33,7 +33,7 @@ namespace Flow.Launcher.Helper public static string RuntimeInfo() { var info = $"\nFlow Launcher version: {Constant.Version}" + - $"\nOS Version: {ExceptionFormatter.GetWindowsBuildVersionFromRegistry()}" + + $"\nOS Version: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}" + $"\nIntPtr Length: {IntPtr.Size}" + $"\nx64: {Environment.Is64BitOperatingSystem}"; return info; From b74ea0071de712b22aab82328455bc49793ff784 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:25:39 +0800 Subject: [PATCH 3/5] Use OSVersion.Version.Build to reduce registry access --- .../Exception/ExceptionFormatter.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index 63f670c66..025109e58 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -177,12 +177,9 @@ namespace Flow.Launcher.Infrastructure.Exception { try { - using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\")) - { - var buildRevision = GetWindowsRevisionFromRegistry(); - var currentBuild = registryKey.GetValue("CurrentBuild").ToString(); - return currentBuild + "." + buildRevision; - } + var buildRevision = GetWindowsRevisionFromRegistry(); + var currentBuild = Environment.OSVersion.Version.Build; + return currentBuild.ToString() + "." + buildRevision; } catch { From 0b4d68505a89a68896a239cf8de9a655a0c186dc Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:46:22 +0800 Subject: [PATCH 4/5] Change issue URL to issue list Guide users to the issue list to see if there's any pinned issue and search first, instead of posting an issue immediately --- Flow.Launcher.Infrastructure/Constant.cs | 2 +- Flow.Launcher/ReportWindow.xaml.cs | 4 ++-- Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index e23d2137e..393efc32e 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -19,7 +19,7 @@ namespace Flow.Launcher.Infrastructure public static readonly string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString(); public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins); - public const string Issue = "https://github.com/Flow-Launcher/Flow.Launcher/issues/new/choose"; + public const string Issue = "https://github.com/Flow-Launcher/Flow.Launcher/issues"; public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion; public static readonly string Dev = "Dev"; public const string Documentation = "https://flowlauncher.com/docs/#/usage-tips"; diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs index 4899edc14..217f294c5 100644 --- a/Flow.Launcher/ReportWindow.xaml.cs +++ b/Flow.Launcher/ReportWindow.xaml.cs @@ -34,7 +34,7 @@ namespace Flow.Launcher return Constant.Issue; } var treeIndex = website.IndexOf("tree", StringComparison.Ordinal); - return treeIndex == -1 ? $"{website}/issues/new" : $"{website[..treeIndex]}/issues/new"; + return treeIndex == -1 ? $"{website}/issues" : $"{website[..treeIndex]}/issues"; } private void SetException(Exception exception) @@ -86,4 +86,4 @@ namespace Flow.Launcher return paragraph; } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs index 37f0a126e..73627592a 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs @@ -53,7 +53,7 @@ namespace Flow.Launcher.Plugin.PluginsManager { // standard UrlSourceCode format in PluginsManifest's plugins.json file: https://github.com/jjw24/Flow.Launcher.Plugin.Putty/tree/master var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com") - ? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues/new/choose" + ? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues" : pluginManifestInfo.UrlSourceCode; Context.API.OpenUrl(link); From 75dfb626710359d0322b7a35eb35bd4ff4a8131b Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 3 May 2023 07:02:30 +1000 Subject: [PATCH 5/5] update GitHub issue url constant variable and method names --- Flow.Launcher.Infrastructure/Constant.cs | 2 +- Flow.Launcher/ReportWindow.xaml.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index 393efc32e..7a95b52d5 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -19,7 +19,7 @@ namespace Flow.Launcher.Infrastructure public static readonly string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString(); public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins); - public const string Issue = "https://github.com/Flow-Launcher/Flow.Launcher/issues"; + public const string IssuesUrl = "https://github.com/Flow-Launcher/Flow.Launcher/issues"; public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion; public static readonly string Dev = "Dev"; public const string Documentation = "https://flowlauncher.com/docs/#/usage-tips"; diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs index 217f294c5..a2e7a8562 100644 --- a/Flow.Launcher/ReportWindow.xaml.cs +++ b/Flow.Launcher/ReportWindow.xaml.cs @@ -23,7 +23,7 @@ namespace Flow.Launcher SetException(exception); } - private static string GetIssueUrl(string website) + private static string GetIssuesUrl(string website) { if (!website.StartsWith("https://github.com")) { @@ -31,7 +31,7 @@ namespace Flow.Launcher } if(website.Contains("Flow-Launcher/Flow.Launcher")) { - return Constant.Issue; + return Constant.IssuesUrl; } var treeIndex = website.IndexOf("tree", StringComparison.Ordinal); return treeIndex == -1 ? $"{website}/issues" : $"{website[..treeIndex]}/issues"; @@ -45,8 +45,8 @@ namespace Flow.Launcher var websiteUrl = exception switch { - FlowPluginException pluginException =>GetIssueUrl(pluginException.Metadata.Website), - _ => Constant.Issue + FlowPluginException pluginException =>GetIssuesUrl(pluginException.Metadata.Website), + _ => Constant.IssuesUrl };