From 2757dc7205c0be64f400808774bf0740fc5907e0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 27 Oct 2019 14:22:50 +1100 Subject: [PATCH 01/24] Add known error when trying to retrieve UWP program's thumbnail --- Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs index c8a104b101..b69ad94a47 100644 --- a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs +++ b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs @@ -110,7 +110,7 @@ namespace Wox.Plugin.Program.Logger private static bool IsKnownUWPProgramError(Exception e, string callingMethodName) { if (((e.HResult == -2147024774 || e.HResult == -2147009769) && callingMethodName == "ResourceFromPri") - || (e.HResult == -2147024894 && callingMethodName == "LogoPathFromUri")) + || (e.HResult == -2147024894 && (callingMethodName == "LogoPathFromUri" || callingMethodName == "ImageFromPath"))) return true; if (callingMethodName == "XmlNamespaces") From ea54abdfde6f9e228ff31bd63902aa64c3a77ce0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 27 Oct 2019 19:04:10 +1100 Subject: [PATCH 02/24] Add file being held by another process error to known This occurs during app initialisation, and add empty list to allow continuing during debug --- Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs | 3 ++- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs index b69ad94a47..c803896ce6 100644 --- a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs +++ b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs @@ -110,7 +110,8 @@ namespace Wox.Plugin.Program.Logger private static bool IsKnownUWPProgramError(Exception e, string callingMethodName) { if (((e.HResult == -2147024774 || e.HResult == -2147009769) && callingMethodName == "ResourceFromPri") - || (e.HResult == -2147024894 && (callingMethodName == "LogoPathFromUri" || callingMethodName == "ImageFromPath"))) + || (e.HResult == -2147024894 && (callingMethodName == "LogoPathFromUri" || callingMethodName == "ImageFromPath")) + || (e.HResult == -2147024864 && callingMethodName == "InitializeAppInfo")) return true; if (callingMethodName == "XmlNamespaces") diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 360b744319..4ce5d76e24 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -86,6 +86,8 @@ namespace Wox.Plugin.Program.Programs var e = Marshal.GetExceptionForHR((int)hResult); ProgramLogger.LogException($"|UWP|InitializeAppInfo|{path}" + "|Error caused while trying to get the details of the UWP program", e); + + Apps = new List().ToArray(); } } From 8a676c573adf4ffbdf85e7b16474e36204147903 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 7 Nov 2019 07:40:04 +1100 Subject: [PATCH 03/24] Fix error message logging for prod run --- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 360b744319..8fef2e49bf 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -157,7 +157,7 @@ namespace Wox.Plugin.Program.Programs #if !DEBUG catch (Exception e) { - ProgramLogger.LogException("|UWP|All|An unexpected error occured and " + ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occured and " + $"unable to convert Package to UWP for {p.Id.FullName}", e); return new Application[] { }; } From 46274acb3ebb94cd53c78cac41188331e852e8fc Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 7 Nov 2019 07:46:18 +1100 Subject: [PATCH 04/24] Add error message specification --- Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs | 3 ++- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs index c8a104b101..ed3dd89427 100644 --- a/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs +++ b/Plugins/Wox.Plugin.Program/Logger/ProgramLogger.cs @@ -41,7 +41,8 @@ namespace Wox.Plugin.Program.Logger } /// - /// Please follow exception format: |class name|calling method name|loading program path|user friendly message that explains the error + /// Please follow exception format, there are four parts to an error message that need to be specified: + /// |class name|calling method name|loading program path|user friendly message that explains the error /// => Example: |Win32|LnkProgram|c:\..\chrome.exe|Permission denied on directory, but Wox should continue /// [MethodImpl(MethodImplOptions.Synchronized)] diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 8fef2e49bf..cb1fa54211 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -163,9 +163,9 @@ namespace Wox.Plugin.Program.Programs } #endif #if DEBUG //make developer aware and implement handling - catch(Exception) + catch(Exception e) { - throw; + throw e; } #endif return u.Apps; From 5b7a71fb080b2228afa271c2575e2900d813788c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 8 Nov 2019 05:38:40 +1100 Subject: [PATCH 05/24] Fix missing required parameter in logger --- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 5c4c3cdeb1..60f978b9dc 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -207,7 +207,7 @@ namespace Wox.Plugin.Program.Programs } catch (Exception e) { - ProgramLogger.LogException("|UWP|CurrentUserPackages|An unexpected error occured and " + ProgramLogger.LogException("|UWP|CurrentUserPackages|Not available|An unexpected error occured and " + $"unable to verify if package is valid", e); return false; } From 93c952b344f336b3c2405e02f21f3ec9239c72e9 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 8 Nov 2019 05:47:54 +1100 Subject: [PATCH 06/24] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 36628d4c00..d7ccabd408 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Features Installation ------------ +View new features released from this fork since Wox v1.3.524: [new releases](https://github.com/jjw24/Wox/releases) + To install this fork's version of Wox, you can **download** it [here](https://github.com/jjw24/Wox/releases/latest). To install the upstream version: From ed59d6acf5bbba76075d16c7f8b9c55e868bcda1 Mon Sep 17 00:00:00 2001 From: AT <14300910+theClueless@users.noreply.github.com> Date: Sat, 9 Nov 2019 11:55:53 +0200 Subject: [PATCH 07/24] when both icopath and icon delegdate are empty\null it will raise an exception. currently delegate is verified and an error icon will be presented (same as before) but without raising an excpetion. --- Wox/ViewModel/ResultViewModel.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Wox/ViewModel/ResultViewModel.cs b/Wox/ViewModel/ResultViewModel.cs index a2ce53de2b..1d610db2fe 100644 --- a/Wox/ViewModel/ResultViewModel.cs +++ b/Wox/ViewModel/ResultViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Media; using System.Windows.Threading; +using Wox.Infrastructure; using Wox.Infrastructure.Image; using Wox.Infrastructure.Logger; using Wox.Plugin; @@ -22,7 +23,8 @@ namespace Wox.ViewModel { get { - if (string.IsNullOrEmpty(Result.IcoPath)) + var imagePath = Result.IcoPath; + if (string.IsNullOrEmpty(imagePath) && Result.Icon != null) { try { @@ -31,13 +33,12 @@ namespace Wox.ViewModel catch (Exception e) { Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e); - return ImageLoader.Load(Result.IcoPath); + imagePath = Constant.ErrorIcon; } } - else - { - return ImageLoader.Load(Result.IcoPath); - } + + // will get here either when icoPath has value\icon delegate is null\when had exception in delegate + return ImageLoader.Load(imagePath); } } From 2debabe66426417494ba1a364082326fea8dc5bd Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 19:12:43 +1100 Subject: [PATCH 08/24] Add option to open in tab for WebSearch plugin --- Plugins/Wox.Plugin.WebSearch/Main.cs | 19 +++++++++++++++-- Plugins/Wox.Plugin.WebSearch/Settings.cs | 2 ++ Wox.Plugin/SharedCommands/SearchWeb.cs | 26 +++++++++++++++++++++--- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index ec4033ac33..095ce20e19 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -74,7 +74,14 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(""); + if (_settings.OpenInNewBrowser) + { + searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(""); + } + else + { + searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewTabInBrowser(""); + } return true; } @@ -132,7 +139,15 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(""); + if (_settings.OpenInNewBrowser) + { + searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(""); + } + else + { + searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewTabInBrowser(""); + } + return true; } }); diff --git a/Plugins/Wox.Plugin.WebSearch/Settings.cs b/Plugins/Wox.Plugin.WebSearch/Settings.cs index 6277ab7530..5f7a3913e6 100644 --- a/Plugins/Wox.Plugin.WebSearch/Settings.cs +++ b/Plugins/Wox.Plugin.WebSearch/Settings.cs @@ -219,5 +219,7 @@ namespace Wox.Plugin.WebSearch } } } + + public bool OpenInNewBrowser { get; set; } = true; } } \ No newline at end of file diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 853fca43dc..0d94bfd6df 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -7,7 +7,8 @@ namespace Wox.Plugin.SharedCommands { public static class SearchWeb { - /// Opens search in a new browser. If no browser path is passed in then Chrome is used. + /// + /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// public static void NewBrowserWindow(this string url, string browserPath) @@ -19,11 +20,30 @@ namespace Wox.Plugin.SharedCommands var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; // Internet Explorer will open url in new browser window, and does not take the --new-window parameter - var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; + var browserArguements = browserExecutableName == "iexplore.exe" ? "" : "--new-window "; + OpenWebSearch(browser, browserArguements, url); + } + + /// + /// Opens search as a tab in the default browser chosen in Windows settings. + /// + public static void NewTabInBrowser(this string url, string browserPath) + { + var browserExecutableName = browserPath? + .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "" : browserPath; + + OpenWebSearch(browser, "", url); + } + + private static void OpenWebSearch(string chosenBrowser, string browserArguements, string url) + { try { - Process.Start(browser, browserArguements); + Process.Start(chosenBrowser, browserArguements + url); } catch (System.ComponentModel.Win32Exception) { From b565d1ab762b92683d72d210f3927804a7f61439 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 19:51:50 +1100 Subject: [PATCH 09/24] Update naming --- Wox.Plugin/SharedCommands/SearchWeb.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 0d94bfd6df..e40c405421 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -17,12 +17,12 @@ namespace Wox.Plugin.SharedCommands .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) .Last(); - var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; // Internet Explorer will open url in new browser window, and does not take the --new-window parameter var browserArguements = browserExecutableName == "iexplore.exe" ? "" : "--new-window "; - OpenWebSearch(browser, browserArguements, url); + OpenWebSearch(selectedBrowserPath, browserArguements, url); } /// @@ -34,9 +34,9 @@ namespace Wox.Plugin.SharedCommands .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) .Last(); - var browser = string.IsNullOrEmpty(browserExecutableName) ? "" : browserPath; + var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "" : browserPath; - OpenWebSearch(browser, "", url); + OpenWebSearch(selectedBrowserPath, "", url); } private static void OpenWebSearch(string chosenBrowser, string browserArguements, string url) From 3e292d7604690ff8fbbf492feb2f2786516d60f8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 20:12:45 +1100 Subject: [PATCH 10/24] Reverse changes made to new browser window call --- Wox.Plugin/SharedCommands/SearchWeb.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index e40c405421..52a79a51b5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -11,18 +11,25 @@ namespace Wox.Plugin.SharedCommands /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - public static void NewBrowserWindow(this string url, string browserPath) + public static void NewBrowserWindow(this string url, string browserPath) { var browserExecutableName = browserPath? .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) .Last(); - var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; // Internet Explorer will open url in new browser window, and does not take the --new-window parameter - var browserArguements = browserExecutableName == "iexplore.exe" ? "" : "--new-window "; + var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; - OpenWebSearch(selectedBrowserPath, browserArguements, url); + try + { + Process.Start(browser, browserArguements); + } + catch (System.ComponentModel.Win32Exception) + { + Process.Start(url); + } } /// From adb2582856748153ee155d31025e298941eb2608 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 20:15:14 +1100 Subject: [PATCH 11/24] Reverse out common open browser call and update open browser in tab --- Wox.Plugin/SharedCommands/SearchWeb.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 52a79a51b5..f91025bffd 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -36,22 +36,19 @@ namespace Wox.Plugin.SharedCommands /// Opens search as a tab in the default browser chosen in Windows settings. /// public static void NewTabInBrowser(this string url, string browserPath) - { - var browserExecutableName = browserPath? - .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); - - var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "" : browserPath; - - OpenWebSearch(selectedBrowserPath, "", url); - } - - private static void OpenWebSearch(string chosenBrowser, string browserArguements, string url) { try { - Process.Start(chosenBrowser, browserArguements + url); + if (!string.IsNullOrEmpty(browserPath)) + { + Process.Start(browserPath, url); + } + else + { + Process.Start(url); + } } + // This error may be thrown for Process.Start(browserPath, url) catch (System.ComponentModel.Win32Exception) { Process.Start(url); From 23712ce59067193272bcac6beaabb7be731e1d4c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 20:43:40 +1100 Subject: [PATCH 12/24] Add option in WebSearches plugin settings panel for user selection --- Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml | 3 +++ Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml index 01b2d25c66..fd4320e4fa 100644 --- a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml +++ b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml @@ -23,6 +23,9 @@ SelectedItem="{Binding Settings.SelectedSuggestion}" IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}" Margin="10" /> +