From 6a43b8b159e12667a8280187f19e405f7f8d2f94 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Thu, 2 Apr 2020 15:53:39 -0700 Subject: [PATCH 1/5] copy resource files to output folder --- .../Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index 37f4a2e7bd..f6e8c454d3 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -39,4 +39,13 @@ + + + PreserveNewest + + + PreserveNewest + + + From 38490195e3ed772e2f2abf7a459a10fafd4e9a32 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Thu, 2 Apr 2020 15:55:30 -0700 Subject: [PATCH 2/5] Corrected the output path for the indexer plugin --- .../Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index f6e8c454d3..0631ed280b 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -7,7 +7,7 @@ true - ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Wox.Plugin.Folder\ + ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Wox.Plugin.Indexer\ DEBUG;TRACE full x64 @@ -19,7 +19,7 @@ - ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Wox.Plugin.Folder\ + ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Wox.Plugin.Indexer\ TRACE true pdbonly From ad6ca65d4b3da20bd302425edac69515226c3d98 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Thu, 2 Apr 2020 17:49:43 -0700 Subject: [PATCH 3/5] windows indexer plugin is working --- .../launcher/Plugins/Wox.Plugin.Indexer/Main.cs | 2 +- .../SearchHelper/WindowsSearchAPI.cs | 10 ++++++---- .../Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj | 13 ++++++++++++- src/modules/launcher/Wox/Wox.csproj | 2 ++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs index 652af40c40..8d6af797e9 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Main.cs @@ -92,7 +92,7 @@ namespace Wox.Plugin.Indexer results.Add(new Result { // TODO: Localize the string - Title = "Windows indexer plugin is not running", + Title = ex.ToString(), IcoPath = "Images\\WindowsIndexerImg.bmp" }); } diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs index 64875595a1..23dc200635 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs @@ -32,10 +32,12 @@ namespace Wox.Plugin.Indexer.SearchHelper while (WDSResults.Read()) { // col 0 is our path in display format - Console.WriteLine("{0}", WDSResults.GetString(0)); - var result = new SearchResult { Path = WDSResults.GetString(0) }; - - yield return result; + if (WDSResults.GetString(0) != null) + { + //Console.WriteLine("{0}", WDSResults.GetString(0)); + var result = new SearchResult { Path = WDSResults.GetString(0) }; + yield return result; + } } } diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index 0631ed280b..eb9676e683 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -1,7 +1,14 @@ - + netcoreapp3.1 + {F8B870EB-D5F5-45BA-9CF7-A5C459818820} + Properties + Wox.Plugin.Indexer + Wox.Plugin.Indexer + true + false + false x64 @@ -48,4 +55,8 @@ + + + + diff --git a/src/modules/launcher/Wox/Wox.csproj b/src/modules/launcher/Wox/Wox.csproj index a67357ac21..fc0cd94bd9 100644 --- a/src/modules/launcher/Wox/Wox.csproj +++ b/src/modules/launcher/Wox/Wox.csproj @@ -68,9 +68,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + From 57c616abfed5349f3e20e644ecaaf95d0e1dfc77 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Thu, 2 Apr 2020 18:03:40 -0700 Subject: [PATCH 4/5] Remove console print statement --- .../Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs index 23dc200635..fb7b6ffcd1 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs @@ -34,7 +34,6 @@ namespace Wox.Plugin.Indexer.SearchHelper // col 0 is our path in display format if (WDSResults.GetString(0) != null) { - //Console.WriteLine("{0}", WDSResults.GetString(0)); var result = new SearchResult { Path = WDSResults.GetString(0) }; yield return result; } From 949e504ad58a1adcfab0ea601654858ca8f4a867 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 12 Mar 2020 09:57:36 +1100 Subject: [PATCH 5/5] Cherry picked pinyin performance changes from jjw24's master branch --- .../Wox.Core/Resource/Internationalization.cs | 16 ++++++++++ .../launcher/Wox.Infrastructure/Alphabet.cs | 2 +- .../UserSettings/Settings.cs | 3 +- .../Wox/ViewModel/SettingWindowViewModel.cs | 29 ++++++++++++++++++- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/modules/launcher/Wox.Core/Resource/Internationalization.cs b/src/modules/launcher/Wox.Core/Resource/Internationalization.cs index 9f865cb539..53cce9174c 100644 --- a/src/modules/launcher/Wox.Core/Resource/Internationalization.cs +++ b/src/modules/launcher/Wox.Core/Resource/Internationalization.cs @@ -99,6 +99,22 @@ namespace Wox.Core.Resource } + 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/src/modules/launcher/Wox.Infrastructure/Alphabet.cs b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs index 487c0a4b0a..4754394cbc 100644 --- a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs +++ b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs @@ -162,7 +162,7 @@ namespace Wox.Infrastructure 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/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs index 7714768f00..94a1639d65 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs @@ -25,8 +25,7 @@ namespace Wox.Infrastructure.UserSettings /// /// 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/src/modules/launcher/Wox/ViewModel/SettingWindowViewModel.cs b/src/modules/launcher/Wox/ViewModel/SettingWindowViewModel.cs index 504e7bdfae..f9160df9f0 100644 --- a/src/modules/launcher/Wox/ViewModel/SettingWindowViewModel.cs +++ b/src/modules/launcher/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 @@ namespace Wox.ViewModel } } + 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