From 8079e7a38ab13329a8e421d486172022f46a51ca Mon Sep 17 00:00:00 2001 From: "Lin Yu-Chieh (Victor)" Date: Thu, 14 Jul 2022 14:00:10 +0800 Subject: [PATCH] regex close #21 --- Main.cs | 17 +++++++++-------- NativeMethods.cs | 6 +++--- Properties/Resources.Designer.cs | 12 ++++++------ Properties/Resources.ar.resx | 3 --- Properties/Resources.de.resx | 3 --- Properties/Resources.hi.resx | 3 --- Properties/Resources.it.resx | 3 --- Properties/Resources.ja.resx | 3 --- Properties/Resources.ko.resx | 3 --- Properties/Resources.resx | 6 +++--- Properties/Resources.ro.resx | 3 --- Properties/Resources.sv.resx | 3 --- Properties/Resources.zh-cn.resx | 3 --- Properties/Resources.zh.resx | 3 --- plugin.json | 2 +- 15 files changed, 22 insertions(+), 51 deletions(-) diff --git a/Main.cs b/Main.cs index 3cd6d00..3373d66 100644 --- a/Main.cs +++ b/Main.cs @@ -25,10 +25,10 @@ namespace Community.PowerToys.Run.Plugin.Everything public class Main : IPlugin, IDisposable, IDelayedExecutionPlugin, IContextMenu, ISettingProvider, IPluginI18n { private const string AltIcon = nameof(AltIcon); - private const string Top = nameof(Top); + private const string RegEx = nameof(RegEx); private const string NoPreview = nameof(NoPreview); private readonly string reservedStringPattern = @"^[\/\\\$\%]+$|^.*[<>].*$"; - private bool top; + private bool regEx; private bool preview; private bool altIcon; @@ -52,8 +52,8 @@ public class Main : IPlugin, IDisposable, IDelayedExecutionPlugin, IContextMenu, }, new PluginAdditionalOption() { - Key = Top, - DisplayLabel = Resources.Top, + Key = RegEx, + DisplayLabel = Resources.RegEx, Value = false, }, }; @@ -88,7 +88,7 @@ public List Query(Query query, bool delayedExecution) { try { - results.AddRange(EverythingSearch(searchQuery, this.top, this.preview, this.altIcon)); + results.AddRange(EverythingSearch(searchQuery, this.preview, this.altIcon)); } catch (System.ComponentModel.Win32Exception) { @@ -123,17 +123,18 @@ public Control CreateSettingPanel() public void UpdateSettings(PowerLauncherPluginSettings settings) { - var top = false; + var regX = false; var nopreview = false; var alt = false; if (settings != null && settings.AdditionalOptions != null) { - top = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Top)?.Value ?? false; + regX = settings.AdditionalOptions.FirstOrDefault(x => x.Key == RegEx)?.Value ?? false; nopreview = settings.AdditionalOptions.FirstOrDefault(x => x.Key == NoPreview)?.Value ?? false; alt = settings.AdditionalOptions.FirstOrDefault(x => x.Key == AltIcon)?.Value ?? false; } - this.top = top; + this.regEx = regX; + Everything_SetRegex(this.regEx); this.preview = nopreview; this.altIcon = alt; } diff --git a/NativeMethods.cs b/NativeMethods.cs index 88e2da7..5f2950b 100644 --- a/NativeMethods.cs +++ b/NativeMethods.cs @@ -131,6 +131,8 @@ internal enum AssocStr [DllImport(dllName)] internal static extern void Everything_SetMax(uint dwMax); [DllImport(dllName)] + internal static extern void Everything_SetRegex(bool bEnable); + [DllImport(dllName)] internal static extern void Everything_SetRequestFlags(Request RequestFlags); [DllImport(dllName, CharSet = CharSet.Unicode)] internal static extern uint Everything_SetSearchW(string lpSearchString); @@ -184,7 +186,7 @@ private static void GetCustomSettings() #endif } - public static IEnumerable EverythingSearch(string qry, bool top, bool preview, bool legacy) + public static IEnumerable EverythingSearch(string qry, bool preview, bool legacy) { #if DEBUG string orgqry = qry; @@ -261,10 +263,8 @@ public static IEnumerable EverythingSearch(string qry, bool top, bool pr } } }, - QueryTextDisplay = isFolder ? path : name, }; - if (top) r.Score = (int)(max - i); yield return r; } } diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 772131e..1816897 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -160,20 +160,20 @@ public static string Preview { } /// - /// Looks up a localized string similar to Run as administrator (Ctrl+Shift+Enter). + /// Looks up a localized string similar to RegEx - Enable regular expression in search.. /// - public static string run_as_admin { + public static string RegEx { get { - return ResourceManager.GetString("run_as_admin", resourceCulture); + return ResourceManager.GetString("RegEx", resourceCulture); } } /// - /// Looks up a localized string similar to Top - Insert result at the top of the list, may cause pre-selection issue.. + /// Looks up a localized string similar to Run as administrator (Ctrl+Shift+Enter). /// - public static string Top { + public static string run_as_admin { get { - return ResourceManager.GetString("Top", resourceCulture); + return ResourceManager.GetString("run_as_admin", resourceCulture); } } } diff --git a/Properties/Resources.ar.resx b/Properties/Resources.ar.resx index ea74b7c..d2ec1b4 100644 --- a/Properties/Resources.ar.resx +++ b/Properties/Resources.ar.resx @@ -150,7 +150,4 @@ تشغيل كمسؤول (Ctrl + Shift + Enter) - - أعلى القائمة - قد يتسبب إدراج النتيجة في أعلى القائمة في حدوث مشكلة في الاختيار المسبق. - \ No newline at end of file diff --git a/Properties/Resources.de.resx b/Properties/Resources.de.resx index 2a3fb51..e889b22 100644 --- a/Properties/Resources.de.resx +++ b/Properties/Resources.de.resx @@ -150,7 +150,4 @@ Als Administrator ausführen (Strg+Shift+Enter) - - Oben – Ergebnis am Anfang der Liste einfügen, kann zu Problemen bei der Vorauswahl führen. - \ No newline at end of file diff --git a/Properties/Resources.hi.resx b/Properties/Resources.hi.resx index 759029d..74f39f1 100644 --- a/Properties/Resources.hi.resx +++ b/Properties/Resources.hi.resx @@ -150,7 +150,4 @@ व्यवस्थापक के रूप में चलाएँ (Ctrl+Shift+Enter) - - शीर्ष - सूची के शीर्ष पर परिणाम सम्मिलित करें, पूर्व-चयन समस्या का कारण हो सकता है। - \ No newline at end of file diff --git a/Properties/Resources.it.resx b/Properties/Resources.it.resx index 7876416..288ace0 100644 --- a/Properties/Resources.it.resx +++ b/Properties/Resources.it.resx @@ -150,7 +150,4 @@ Esegui come amministratore (Ctrl+Maiusc+Invio) - - In alto: inserire il risultato in cima all'elenco, potrebbe causare problemi di preselezione. - \ No newline at end of file diff --git a/Properties/Resources.ja.resx b/Properties/Resources.ja.resx index 264f0c9..d97ffae 100644 --- a/Properties/Resources.ja.resx +++ b/Properties/Resources.ja.resx @@ -150,7 +150,4 @@ 管理者として実行(Ctrl + Shift + Enter) - - トップ-リストの一番上に結果を挿入します。事前選択の問題が発生する可能性があります。 - \ No newline at end of file diff --git a/Properties/Resources.ko.resx b/Properties/Resources.ko.resx index 1e2e4fe..78c3c74 100644 --- a/Properties/Resources.ko.resx +++ b/Properties/Resources.ko.resx @@ -150,7 +150,4 @@ 관리자 권한으로 실행(Ctrl+Shift+Enter) - - 상단 - 목록 상단에 결과를 삽입하면 사전 선택 문제가 발생할 수 있습니다. - \ No newline at end of file diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 80d41dd..0ede30f 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -150,10 +150,10 @@ Preview - Preview file content as icon, may cause freezing if file is not local. + + RegEx - Enable regular expression in search. + Run as administrator (Ctrl+Shift+Enter) - - Top - Insert result at the top of the list, may cause pre-selection issue. - \ No newline at end of file diff --git a/Properties/Resources.ro.resx b/Properties/Resources.ro.resx index f2f6069..c92ba91 100644 --- a/Properties/Resources.ro.resx +++ b/Properties/Resources.ro.resx @@ -150,7 +150,4 @@ Rulați ca administrator (Ctrl+Shift+Enter) - - Sus - Introduceți rezultatul în partea de sus a listei, poate cauza probleme de preselecție. - \ No newline at end of file diff --git a/Properties/Resources.sv.resx b/Properties/Resources.sv.resx index 0828ddd..306ef7f 100644 --- a/Properties/Resources.sv.resx +++ b/Properties/Resources.sv.resx @@ -150,7 +150,4 @@ Kör som administratör (Ctrl+Skift+Enter) - - Topp - Infoga resultat högst upp i listan, kan orsaka förvalsproblem. - \ No newline at end of file diff --git a/Properties/Resources.zh-cn.resx b/Properties/Resources.zh-cn.resx index 357b91c..7de4e49 100644 --- a/Properties/Resources.zh-cn.resx +++ b/Properties/Resources.zh-cn.resx @@ -150,7 +150,4 @@ 以管理员身份运行 (Ctrl+Shift+Enter) - - 顶部 - 在列表顶部插入结果,可能会导致预选问题 - \ No newline at end of file diff --git a/Properties/Resources.zh.resx b/Properties/Resources.zh.resx index b9f1a70..697184a 100644 --- a/Properties/Resources.zh.resx +++ b/Properties/Resources.zh.resx @@ -150,7 +150,4 @@ 以系統管理員身分執行 (Ctrl+Shift+Enter) - - 至頂 - 將結果至頂, 可能會造成預選結果有誤. - \ No newline at end of file diff --git a/plugin.json b/plugin.json index bc2eb06..c357558 100644 --- a/plugin.json +++ b/plugin.json @@ -4,7 +4,7 @@ "IsGlobal": true, "Name": "Everything", "Author": "Yu Chieh (Victor) Lin", - "Version": "0.59.1", + "Version": "0.60.1", "Language": "csharp", "Website": "https://github.com/lin-ycv/EverythingPowerToys", "ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",