From 0f2ebfbe009e6a1399131f90cc7d3dd4ef2fc27b Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 10 Mar 2020 18:35:31 +1100 Subject: [PATCH 1/2] Remove UwpDesktop library dependency and upgrade to framework 4.6.2 (#159) * Remove UwpDesktop dependency of lower sdk and add Win SDK Contracts * Upgrade from .Net Framework 4.5.2 to 4.6.2 This upgrade is needed to use Microsoft Windows SDK Contracts library from previous commit * Remove Windows SDK references as no longer required --- Plugins/HelloWorldCSharp/App.config | 6 +++--- Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj | 3 ++- .../Wox.Plugin.BrowserBookmark.csproj | 2 +- Plugins/Wox.Plugin.BrowserBookmark/app.config | 14 +++++++------- .../Wox.Plugin.Calculator.csproj | 2 +- Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj | 2 +- .../Wox.Plugin.ControlPanel.csproj | 2 +- .../Wox.Plugin.Everything.csproj | 2 +- Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj | 2 +- .../Wox.Plugin.PluginIndicator.csproj | 2 +- .../Wox.Plugin.PluginManagement.csproj | 2 +- .../Wox.Plugin.Program/Wox.Plugin.Program.csproj | 8 ++++---- Plugins/Wox.Plugin.Shell/Wox.Plugin.Shell.csproj | 2 +- Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj | 2 +- Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj | 2 +- .../Wox.Plugin.WebSearch.csproj | 2 +- README.md | 12 +----------- Wox.Core/Wox.Core.csproj | 2 +- Wox.Infrastructure/Wox.Infrastructure.csproj | 2 +- Wox.Plugin/Wox.Plugin.csproj | 2 +- Wox.Test/Wox.Test.csproj | 2 +- Wox/App.config | 8 ++++---- Wox/Properties/Resources.Designer.cs | 2 +- Wox/Properties/Settings.Designer.cs | 2 +- Wox/Wox.csproj | 2 +- 25 files changed, 40 insertions(+), 49 deletions(-) diff --git a/Plugins/HelloWorldCSharp/App.config b/Plugins/HelloWorldCSharp/App.config index 88fa4027b..8d234373a 100644 --- a/Plugins/HelloWorldCSharp/App.config +++ b/Plugins/HelloWorldCSharp/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj index 46006f098..143052a03 100644 --- a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj +++ b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj @@ -9,9 +9,10 @@ Properties HelloWorldCSharp HelloWorldCSharp - v4.5.2 + v4.6.2 512 true + AnyCPU diff --git a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj index 413b0aec7..56456892d 100644 --- a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj +++ b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.BrowserBookmark Wox.Plugin.BrowserBookmark - v4.5.2 + v4.6.2 512 ..\..\ true diff --git a/Plugins/Wox.Plugin.BrowserBookmark/app.config b/Plugins/Wox.Plugin.BrowserBookmark/app.config index 376ff2d53..3b7c7ed0a 100644 --- a/Plugins/Wox.Plugin.BrowserBookmark/app.config +++ b/Plugins/Wox.Plugin.BrowserBookmark/app.config @@ -1,22 +1,22 @@ - + -
+
- + - + - - + + - \ No newline at end of file + diff --git a/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj b/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj index f24ad118e..06d476ef4 100644 --- a/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj +++ b/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.Caculator Wox.Plugin.Caculator - v4.5.2 + v4.6.2 512 ..\..\ diff --git a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj index ca75ed8f3..c7cbc29e5 100644 --- a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj +++ b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.Color Wox.Plugin.Color - v4.5.2 + v4.6.2 512 diff --git a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj index 711cb8e29..97cdc8c02 100644 --- a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj +++ b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.ControlPanel Wox.Plugin.ControlPanel - v4.5.2 + v4.6.2 512 diff --git a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj index 2ec791bf8..65f4e45e5 100644 --- a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj +++ b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.Everything Wox.Plugin.Everything - v4.5.2 + v4.6.2 512 ..\Wox\ diff --git a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj index a75fa0ba9..338e550d5 100644 --- a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj +++ b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.Folder Wox.Plugin.Folder - v4.5.2 + v4.6.2 512 ..\..\ diff --git a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj index 709016b06..2de1309cd 100644 --- a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj +++ b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.PluginIndicator Wox.Plugin.PluginIndicator - v4.5.2 + v4.6.2 512 diff --git a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj index d963ea367..dcf77f487 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj +++ b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.PluginManagement Wox.Plugin.PluginManagement - v4.5.2 + v4.6.2 512 ..\..\ diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 17ccffaba..a5d7700e1 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -9,7 +9,7 @@ Properties Wox.Plugin.Program Wox.Plugin.Program - v4.5.2 + v4.6.2 512 ..\..\ @@ -158,6 +158,9 @@ 10.3.0 + + 10.0.18362.2005 + 9.0.1 @@ -167,9 +170,6 @@ 4.0.0 - - 10.0.14393.3 - - -
+ +
@@ -16,4 +16,4 @@ - \ No newline at end of file + diff --git a/Wox/Properties/Resources.Designer.cs b/Wox/Properties/Resources.Designer.cs index 20e0fb225..26a9ddff9 100644 --- a/Wox/Properties/Resources.Designer.cs +++ b/Wox/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Wox.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Wox/Properties/Settings.Designer.cs b/Wox/Properties/Settings.Designer.cs index a61339f5e..be9020f6e 100644 --- a/Wox/Properties/Settings.Designer.cs +++ b/Wox/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Wox.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 3b942ca65..0aa060ddd 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -9,7 +9,7 @@ Properties Wox Wox - v4.5.2 + v4.6.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 From 37149d99563e559ef1bfdbb86658fedd327f1b24 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 12 Mar 2020 09:57:36 +1100 Subject: [PATCH 2/2] Reduce Wox's drain on CPU when using Pinyin search (#162) * Remove this unneccessary dreadful logging that kills performance * Update to ShouldUsePinyin option 1. Change default start up not to use Pinyin as default language is English 2. Add prompt when switching to Chinese or Chinese_TW prompt user if they want to use Pinyin search --- Wox.Core/Resource/Internationalization.cs | 16 ++++++++++++ Wox.Infrastructure/Alphabet.cs | 2 +- Wox.Infrastructure/UserSettings/Settings.cs | 3 +-- Wox/SettingWindow.xaml | 6 ++--- Wox/SettingWindow.xaml.cs | 6 ----- Wox/ViewModel/SettingWindowViewModel.cs | 29 ++++++++++++++++++++- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/Wox.Core/Resource/Internationalization.cs b/Wox.Core/Resource/Internationalization.cs index 9f865cb53..53cce9174 100644 --- a/Wox.Core/Resource/Internationalization.cs +++ b/Wox.Core/Resource/Internationalization.cs @@ -99,6 +99,22 @@ public void ChangeLanguage(Language language) } + public bool PromptShouldUsePinyin(string languageCodeToSet) + { + var languageToSet = GetLanguageByLanguageCode(languageCodeToSet); + + if (Settings.ShouldUsePinyin) + return false; + + if (languageToSet != AvailableLanguages.Chinese && languageToSet != AvailableLanguages.Chinese_TW) + return false; + + if (MessageBox.Show("Do you want to turn on search with Pinyin?", string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) + return false; + + return true; + } + private void RemoveOldLanguageFiles() { var dicts = Application.Current.Resources.MergedDictionaries; diff --git a/Wox.Infrastructure/Alphabet.cs b/Wox.Infrastructure/Alphabet.cs index 487c0a4b0..4754394cb 100644 --- a/Wox.Infrastructure/Alphabet.cs +++ b/Wox.Infrastructure/Alphabet.cs @@ -162,7 +162,7 @@ public bool ContainsChinese(string word) if (word.Length > 40) { - Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {word}"); + //Skip strings that are too long string for Pinyin conversion. return false; } diff --git a/Wox.Infrastructure/UserSettings/Settings.cs b/Wox.Infrastructure/UserSettings/Settings.cs index 7714768f0..94a1639d6 100644 --- a/Wox.Infrastructure/UserSettings/Settings.cs +++ b/Wox.Infrastructure/UserSettings/Settings.cs @@ -25,8 +25,7 @@ public class Settings : BaseModel /// /// when false Alphabet static service will always return empty results /// - public bool ShouldUsePinyin { get; set; } = true; - + public bool ShouldUsePinyin { get; set; } = false; internal StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular; diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 1eddd8ab6..7fe6d8750 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -55,7 +55,7 @@ - + @@ -72,8 +72,8 @@ - diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 52addf362..df3b363d5 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -40,12 +40,6 @@ public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel) #region General - void OnLanguageChanged(object sender, SelectionChangedEventArgs e) - { - var language = (Language)e.AddedItems[0]; - InternationalizationManager.Instance.ChangeLanguage(language); - } - private void OnAutoStartupChecked(object sender, RoutedEventArgs e) { SetStartup(); diff --git a/Wox/ViewModel/SettingWindowViewModel.cs b/Wox/ViewModel/SettingWindowViewModel.cs index 504e7bdfa..f9160df9f 100644 --- a/Wox/ViewModel/SettingWindowViewModel.cs +++ b/Wox/ViewModel/SettingWindowViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -77,6 +77,33 @@ public List LastQueryModes } } + public string Language + { + get + { + return Settings.Language; + } + set + { + InternationalizationManager.Instance.ChangeLanguage(value); + + if (InternationalizationManager.Instance.PromptShouldUsePinyin(value)) + ShouldUsePinyin = true; + } + } + + public bool ShouldUsePinyin + { + get + { + return Settings.ShouldUsePinyin; + } + set + { + Settings.ShouldUsePinyin = value; + } + } + public List QuerySearchPrecisionStrings { get