From 1b81570338e530d3194be6c99347362d4620cb54 Mon Sep 17 00:00:00 2001 From: Itzik S Date: Mon, 24 Jun 2019 18:01:00 +0300 Subject: [PATCH 01/19] added build instructions for VS 2019 --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3612536468..7d8cd1008b 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,17 @@ Build 1. Install Visual Studio 2015 and tick all Windows 10 sdk options 2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser` +3. Building with VS 2019: + - Apparently last Windows 10 SDK which supported UwpDesktop is version 14393. + (see *https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392* ) + - This is needed to compile "Programs" Plugin (UWP.cs) + - If you use a later SDK version, you will see the "References" of Plugin.Programs as broken. + - However this SDK cannot be intsalled via installer of VS 2019. + - If you encounter problems building using VS 2019, then install above listed SDK using the installer of VS 2017. + - After that you can build using VS 2019. + Documentation ------------- - [Wiki](https://github.com/Wox-launcher/Wox/wiki) - Outdated doc: [WoX doc](http://doc.wox.one). -- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. +- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. \ No newline at end of file From 057108882f06185813faeb14f1c539c635ee9d32 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 1 Aug 2019 20:52:50 +1000 Subject: [PATCH 02/19] Open URL in new window browser --- Plugins/Wox.Plugin.Url/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 6cd486919b..78cb13fac2 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; @@ -85,7 +85,7 @@ namespace Wox.Plugin.Url } else { - Process.Start(_settings.BrowserPath,raw); + Process.Start(_settings.BrowserPath,"--new-window" + raw); } return true; From 52252453d99249ae7da8eb1c2a8faa1f9ed5adf1 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 1 Aug 2019 20:55:13 +1000 Subject: [PATCH 03/19] Update WebSearch plugin as System Plugin or User Plugin --- Plugins/Wox.Plugin.WebSearch/Main.cs | 80 +++++++++++++++------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 1581ddb334..ddb126d84d 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -23,6 +23,8 @@ namespace Wox.Plugin.WebSearch public const string Images = "Images"; public static string ImagesDirectory; + private readonly string SystemPluginSearchSourceWildCardSign = "*"; + public void Save() { _viewModel.Save(); @@ -33,49 +35,55 @@ namespace Wox.Plugin.WebSearch _updateSource?.Cancel(); _updateSource = new CancellationTokenSource(); _updateToken = _updateSource.Token; + + var searchSourceList = new List(); + + _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SystemPluginSearchSourceWildCardSign) + && o.Enabled) + .ToList() + .ForEach(x => searchSourceList.Add(x)); - SearchSource searchSource = - _settings.SearchSources.FirstOrDefault(o => o.ActionKeyword == query.ActionKeyword && o.Enabled); - - if (searchSource != null) + if (searchSourceList.Any()) { - string keyword = query.Search; - string title = keyword; - string subtitle = _context.API.GetTranslation("wox_plugin_websearch_search") + " " + searchSource.Title; - if (string.IsNullOrEmpty(keyword)) + foreach (SearchSource searchSource in searchSourceList) { - var result = new Result + string keyword = query.Search; + string title = keyword; + string subtitle = _context.API.GetTranslation("wox_plugin_websearch_search") + " " + + searchSource.Title; + if (string.IsNullOrEmpty(keyword)) { - Title = subtitle, - SubTitle = string.Empty, - IcoPath = searchSource.IconPath - }; - return new List {result}; - } - else - { - var results = new List(); - var result = new Result - { - Title = title, - SubTitle = subtitle, - Score = 6, - IcoPath = searchSource.IconPath, - Action = c => + var result = new Result { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); - return true; - } - }; - results.Add(result); - UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); - return results; + Title = subtitle, + SubTitle = string.Empty, + IcoPath = searchSource.IconPath + }; + return new List {result}; + } + else + { + var results = new List(); + var result = new Result + { + Title = title, + SubTitle = subtitle, + Score = 6, + IcoPath = searchSource.IconPath, + Action = c => + { + Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); + return true; + } + }; + results.Add(result); + UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); + return results; + } } } - else - { - return new List(); - } + + return new List(); } private void UpdateResultsFromSuggestion(List results, string keyword, string subtitle, From 010218b5cea076783e6f1b013ece85658c8a2309 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 1 Aug 2019 23:27:21 +1000 Subject: [PATCH 04/19] Fix post_build.ps1 script failing due to PS ExecutionPolicy --- Wox/Wox.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 48a5c8697b..eaebb9a722 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -462,7 +462,7 @@ - powershell.exe -NoProfile -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) + powershell -command "$policy = Get-ExecutionPolicy"; "Set-ExecutionPolicy RemoteSigned"; "'-NoProfile -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir)'"; "Set-ExecutionPolicy $policy" taskkill /f /fi "IMAGENAME eq Wox.exe" From 9685dca4deae15fd76753ab75a2f9e37889a8acf Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 00:39:08 +1000 Subject: [PATCH 05/19] Simplified command with Bypass --- Wox/Wox.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index eaebb9a722..cdec30036a 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -462,7 +462,7 @@ - powershell -command "$policy = Get-ExecutionPolicy"; "Set-ExecutionPolicy RemoteSigned"; "'-NoProfile -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir)'"; "Set-ExecutionPolicy $policy" + PowerShell -ExecutionPolicy Bypass -Command "$(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) '$(SolutionDir)'" taskkill /f /fi "IMAGENAME eq Wox.exe" From 89f0cdffc72a6aac432cbe9832beb093770a67e8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 12:32:02 +1000 Subject: [PATCH 06/19] Update Main.cs --- Plugins/Wox.Plugin.WebSearch/Main.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index ddb126d84d..8340a326f8 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -23,7 +23,7 @@ namespace Wox.Plugin.WebSearch public const string Images = "Images"; public static string ImagesDirectory; - private readonly string SystemPluginSearchSourceWildCardSign = "*"; + private readonly string SearchSourceGlobalPluginWildCardSign = "*"; public void Save() { @@ -38,7 +38,7 @@ namespace Wox.Plugin.WebSearch var searchSourceList = new List(); - _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SystemPluginSearchSourceWildCardSign) + _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) && o.Enabled) .ToList() .ForEach(x => searchSourceList.Add(x)); @@ -168,4 +168,4 @@ namespace Wox.Plugin.WebSearch public event ResultUpdatedEventHandler ResultsUpdated; } -} \ No newline at end of file +} From 977d21c929a4cc33b2fc947399ea74b9bc472684 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 13:18:38 +1000 Subject: [PATCH 07/19] Bug fix- Edit & Delete buttons will crash if selected search source is null SelectedSearchSource will be null if the user clicks on Edit or Delete after finishing with previous edit and not highlighting the search source again. --- .../SettingsControl.xaml.cs | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs index d50e595a89..6e210c0d3f 100644 --- a/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/SettingsControl.xaml.cs @@ -1,4 +1,4 @@ -using System.Windows; +using System.Windows; using System.Windows.Controls; using Wox.Core.Plugin; @@ -28,27 +28,33 @@ namespace Wox.Plugin.WebSearch private void OnDeleteSearchSearchClick(object sender, RoutedEventArgs e) { - var selected = _settings.SelectedSearchSource; - var warning = _context.API.GetTranslation("wox_plugin_websearch_delete_warning"); - var formated = string.Format(warning, selected.Title); - - var result = MessageBox.Show(formated, string.Empty, MessageBoxButton.YesNo); - if (result == MessageBoxResult.Yes) + if (_settings.SelectedSearchSource != null) { - var id = _context.CurrentPluginMetadata.ID; - PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); - _settings.SearchSources.Remove(selected); + var selected = _settings.SelectedSearchSource; + var warning = _context.API.GetTranslation("wox_plugin_websearch_delete_warning"); + var formated = string.Format(warning, selected.Title); + + var result = MessageBox.Show(formated, string.Empty, MessageBoxButton.YesNo); + if (result == MessageBoxResult.Yes) + { + var id = _context.CurrentPluginMetadata.ID; + PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); + _settings.SearchSources.Remove(selected); + } } } private void OnEditSearchSourceClick(object sender, RoutedEventArgs e) { - var selected = _settings.SelectedSearchSource; - var webSearch = new SearchSourceSettingWindow + if (_settings.SelectedSearchSource != null) + { + var webSearch = new SearchSourceSettingWindow ( - _settings.SearchSources, _context, selected + _settings.SearchSources, _context, _settings.SelectedSearchSource ); - webSearch.ShowDialog(); + + webSearch.ShowDialog(); + } } } -} \ No newline at end of file +} From e18e923ac6aeff795c0163c672758dbdc3b1e3a9 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 22:14:08 +1000 Subject: [PATCH 08/19] Bugfix and update Fix bug when no browser path specified will be null instead of .Length == 0. Add open url in new browser window by default --- Plugins/Wox.Plugin.Url/Main.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 78cb13fac2..c3229064e1 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Text.RegularExpressions; using System.Windows.Controls; using Wox.Infrastructure.Storage; @@ -79,14 +80,14 @@ namespace Wox.Plugin.Url } try { - if (_settings.BrowserPath.Length == 0) - { - Process.Start(raw); - } - else - { - Process.Start(_settings.BrowserPath,"--new-window" + raw); - } + var browserExecutableName = _settings.BrowserPath?.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None).Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : _settings.BrowserPath; + + // Internet Explorer will open url in new browser window, and does not take the --new-window parameter + var browserArguements = browserExecutableName == "iexplore.exe" ? raw : "--new-window " + raw; + + Process.Start(browser, browserArguements); return true; } From 8f17a49a24876eb0cb82b655108b1f27c1f97fa3 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 2 Aug 2019 22:35:58 +1000 Subject: [PATCH 09/19] Add Black And White Theme --- Wox/Themes/BlackAndWhite.xaml | 1 + Wox/Wox.csproj | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 Wox/Themes/BlackAndWhite.xaml diff --git a/Wox/Themes/BlackAndWhite.xaml b/Wox/Themes/BlackAndWhite.xaml new file mode 100644 index 0000000000..8c3f0cbd45 --- /dev/null +++ b/Wox/Themes/BlackAndWhite.xaml @@ -0,0 +1 @@ + #4F6180 \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 48a5c8697b..85e5b51d25 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -374,6 +374,11 @@ Designer PreserveNewest + + MSBuild:Compile + Designer + PreserveNewest + MSBuild:Compile Designer From cb4fde9a0b45d9c4883536fac819c11b67fa6f7f Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 11:42:08 +1000 Subject: [PATCH 10/19] Mini refactor Move Process.Start to static class level --- .../Commands/SearchWeb.cs | 27 +++++++++++++++++++ Plugins/Wox.Plugin.WebSearch/Main.cs | 6 +++-- .../Wox.Plugin.WebSearch.csproj | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs diff --git a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs new file mode 100644 index 0000000000..7c2cc31813 --- /dev/null +++ b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs @@ -0,0 +1,27 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Wox.Plugin.WebSearch.Commands +{ + internal static class SearchWeb + { + /// Opens search in a new browser. If no browser path is passed in then Chrome is used. + /// Leave browser path blank to use Chrome. + /// + internal static void NewBrowserWindow(this string url, string browserPath) + { + var browserExecutableName = browserPath? + .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + + 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; + + Process.Start(browser, browserArguements); + } + } +} diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 8340a326f8..28d0757613 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows.Controls; using Wox.Infrastructure; using Wox.Infrastructure.Storage; +using Wox.Plugin.WebSearch.Commands; namespace Wox.Plugin.WebSearch { @@ -72,7 +73,8 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); + searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(""); + return true; } }; @@ -123,7 +125,7 @@ namespace Wox.Plugin.WebSearch IcoPath = searchSource.IconPath, Action = c => { - Process.Start(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); + searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(""); return true; } }); diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index 858b6fd433..ae06a9f3c4 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -58,6 +58,7 @@ Properties\SolutionAssemblyInfo.cs + From 9d89c1d692127b0c5be252b483d714502a4887b2 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:38:36 +1000 Subject: [PATCH 11/19] update --- Plugins/Wox.Plugin.WebSearch/Main.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 28d0757613..1df937d564 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -33,12 +33,13 @@ namespace Wox.Plugin.WebSearch public List Query(Query query) { + var searchSourceList = new List(); + var results = new List(); + _updateSource?.Cancel(); _updateSource = new CancellationTokenSource(); _updateToken = _updateSource.Token; - var searchSourceList = new List(); - _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) && o.Enabled) .ToList() @@ -60,11 +61,10 @@ namespace Wox.Plugin.WebSearch SubTitle = string.Empty, IcoPath = searchSource.IconPath }; - return new List {result}; + results.Add(result); } else { - var results = new List(); var result = new Result { Title = title, @@ -79,13 +79,12 @@ namespace Wox.Plugin.WebSearch } }; results.Add(result); - UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); - return results; + UpdateResultsFromSuggestion(results, keyword, subtitle, searchSource, query); } } } - return new List(); + return results; } private void UpdateResultsFromSuggestion(List results, string keyword, string subtitle, From 45483809c50ec35ce448d95a53348a51eff5bee3 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:44:56 +1000 Subject: [PATCH 12/19] Update RemoveActionKeyword method Update the method to handle removal when a plugin has multiple ActionKeywords ie. mix of global and non-global ActionKeywords --- Wox.Core/Plugin/PluginManager.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index ecbf9e3905..97b260114e 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -289,14 +289,20 @@ namespace Wox.Core.Plugin public static void RemoveActionKeyword(string id, string oldActionkeyword) { var plugin = GetPluginForId(id); - if (oldActionkeyword == Query.GlobalPluginWildcardSign) + if (oldActionkeyword == Query.GlobalPluginWildcardSign + && // Plugins may have multiple ActionKeywords that are global, eg. WebSearch + plugin.Metadata.ActionKeywords + .Where(x => x == Query.GlobalPluginWildcardSign) + .ToList() + .Count == 1) { GlobalPlugins.Remove(plugin); } - else - { + + if(oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); - } + + plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); } From ef34a63f7a4416e1499e98fa32055262079f6f6d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:47:05 +1000 Subject: [PATCH 13/19] Update Initialisation of plugin method Handle when plugin has a mix of global and non-global action keywords --- Wox.Core/Plugin/PluginManager.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index 97b260114e..6ca826fd9b 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -106,16 +106,12 @@ namespace Wox.Core.Plugin foreach (var plugin in AllPlugins) { if (IsGlobalPlugin(plugin.Metadata)) - { GlobalPlugins.Add(plugin); - } - else - { - foreach (string actionKeyword in plugin.Metadata.ActionKeywords) - { - NonGlobalPlugins[actionKeyword] = plugin; - } - } + + // Plugins may have multiple ActionKeywords, eg. WebSearch + plugin.Metadata.ActionKeywords.Where(x => x != Query.GlobalPluginWildcardSign) + .ToList() + .ForEach(x => NonGlobalPlugins[x] = plugin); } } From 48180b7ee8e8326ea65f726be5612ef6d046b81f Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 22:06:32 +1000 Subject: [PATCH 14/19] update --- Wox/Wox.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index cdec30036a..69ead938ae 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -462,7 +462,7 @@ - PowerShell -ExecutionPolicy Bypass -Command "$(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) '$(SolutionDir)'" + PowerShell -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) taskkill /f /fi "IMAGENAME eq Wox.exe" From 104156d0848fdc3da0a064cf9bc2e2f3ab9e93b0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 22:08:38 +1000 Subject: [PATCH 15/19] update --- Wox/Wox.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 69ead938ae..9527209ca6 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -462,7 +462,7 @@ - PowerShell -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) + powershell.exe -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) taskkill /f /fi "IMAGENAME eq Wox.exe" From 06d4a82706e832e03a64752fcda5fe960feb03e0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:49:51 +1000 Subject: [PATCH 16/19] Add shared commands and move to shared --- .../Commands/SearchWeb.cs | 27 ------------------- Plugins/Wox.Plugin.WebSearch/Main.cs | 2 +- .../Wox.Plugin.WebSearch.csproj | 1 - Wox.Plugin/SharedCommands/SearchWeb.cs | 6 ++--- 4 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs diff --git a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs b/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs deleted file mode 100644 index 7c2cc31813..0000000000 --- a/Plugins/Wox.Plugin.WebSearch/Commands/SearchWeb.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; - -namespace Wox.Plugin.WebSearch.Commands -{ - internal static class SearchWeb - { - /// Opens search in a new browser. If no browser path is passed in then Chrome is used. - /// Leave browser path blank to use Chrome. - /// - internal static void NewBrowserWindow(this string url, string browserPath) - { - var browserExecutableName = browserPath? - .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); - - 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; - - Process.Start(browser, browserArguements); - } - } -} diff --git a/Plugins/Wox.Plugin.WebSearch/Main.cs b/Plugins/Wox.Plugin.WebSearch/Main.cs index 1df937d564..ea7720329f 100644 --- a/Plugins/Wox.Plugin.WebSearch/Main.cs +++ b/Plugins/Wox.Plugin.WebSearch/Main.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using System.Windows.Controls; using Wox.Infrastructure; using Wox.Infrastructure.Storage; -using Wox.Plugin.WebSearch.Commands; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.WebSearch { diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index ae06a9f3c4..858b6fd433 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -58,7 +58,6 @@ Properties\SolutionAssemblyInfo.cs - diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc31813..0dc03ee6d5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal 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) From 7d9e848edb23ec6dae5b3679f5d69e43cbc41afc Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:58:46 +1000 Subject: [PATCH 17/19] use shared commands --- Plugins/Wox.Plugin.Url/Main.cs | 12 ++---------- Wox.Plugin/SharedCommands/SearchWeb.cs | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index c3229064e1..1c3a708c84 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Text.RegularExpressions; using System.Windows.Controls; using Wox.Infrastructure.Storage; +using Wox.Plugin.SharedCommands; namespace Wox.Plugin.Url { @@ -80,15 +79,8 @@ namespace Wox.Plugin.Url } try { - var browserExecutableName = _settings.BrowserPath?.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None).Last(); - - var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : _settings.BrowserPath; + raw.NewBrowserWindow(_settings.BrowserPath); - // Internet Explorer will open url in new browser window, and does not take the --new-window parameter - var browserArguements = browserExecutableName == "iexplore.exe" ? raw : "--new-window " + raw; - - Process.Start(browser, browserArguements); - return true; } catch(Exception ex) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc31813..0dc03ee6d5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal 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) From 56bd31fe222418248ee2acff75bc94a91da1e0f9 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 06:30:25 +1000 Subject: [PATCH 18/19] Update README.md build instructions for VS 2017/2019 --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7d8cd1008b..7d9ab639ce 100644 --- a/README.md +++ b/README.md @@ -55,20 +55,18 @@ Contribution Build ----- -1. Install Visual Studio 2015 and tick all Windows 10 sdk options -2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser` +Install Visual Studio 2015/2017/2019 -3. Building with VS 2019: - - Apparently last Windows 10 SDK which supported UwpDesktop is version 14393. - (see *https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392* ) - - This is needed to compile "Programs" Plugin (UWP.cs) - - If you use a later SDK version, you will see the "References" of Plugin.Programs as broken. - - However this SDK cannot be intsalled via installer of VS 2019. - - If you encounter problems building using VS 2019, then install above listed SDK using the installer of VS 2017. - - After that you can build using VS 2019. +VS 2015: + - Tick all Windows 10 sdk options + +VS 2017/2019 and later: + - Last Windows 10 SDK which [supported](https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392) UwpDesktop is version 10.0.14393.795. It is needed to compile "Programs" Plugin (UWP.cs), you will see the "References" of Plugin.Programs as broken if you use a later SDK version. + - This SDK cannot be installed via VS 2019 installer. + - Download and install [Windows 10 SDK version 10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916). Documentation ------------- - [Wiki](https://github.com/Wox-launcher/Wox/wiki) - Outdated doc: [WoX doc](http://doc.wox.one). -- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. \ No newline at end of file +- Just ask questions in [issues](https://github.com/Wox-launcher/Wox/issues) for now. From ec54f9a5490cf1efa8d57502567ece9009ea5589 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 20 Aug 2019 06:44:51 +1000 Subject: [PATCH 19/19] Update README.md build instructions for VS 2017/2019 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d9ab639ce..22a1a45d47 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,12 @@ Build Install Visual Studio 2015/2017/2019 -VS 2015: +This project requires Windows 10 SDK: + + VS 2015: - Tick all Windows 10 sdk options -VS 2017/2019 and later: + VS 2017/2019 and later: - Last Windows 10 SDK which [supported](https://github.com/Wox-launcher/Wox/pull/1827#commitcomment-26475392) UwpDesktop is version 10.0.14393.795. It is needed to compile "Programs" Plugin (UWP.cs), you will see the "References" of Plugin.Programs as broken if you use a later SDK version. - This SDK cannot be installed via VS 2019 installer. - Download and install [Windows 10 SDK version 10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916).