Skip to content

Commit

Permalink
regex close #21
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-ycv committed Jul 14, 2022
1 parent 4c727ee commit 8079e7a
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 51 deletions.
17 changes: 9 additions & 8 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
},
};
Expand Down Expand Up @@ -88,7 +88,7 @@ public List<Result> 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)
{
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -184,7 +186,7 @@ private static void GetCustomSettings()
#endif
}

public static IEnumerable<Result> EverythingSearch(string qry, bool top, bool preview, bool legacy)
public static IEnumerable<Result> EverythingSearch(string qry, bool preview, bool legacy)
{
#if DEBUG
string orgqry = qry;
Expand Down Expand Up @@ -261,10 +263,8 @@ public static IEnumerable<Result> EverythingSearch(string qry, bool top, bool pr
}
}
},

QueryTextDisplay = isFolder ? path : name,
};
if (top) r.Score = (int)(max - i);
yield return r;
}
}
Expand Down
12 changes: 6 additions & 6 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Properties/Resources.ar.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>تشغيل كمسؤول (Ctrl + Shift + Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>أعلى القائمة - قد يتسبب إدراج النتيجة في أعلى القائمة في حدوث مشكلة في الاختيار المسبق.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>Als Administrator ausführen (Strg+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>Oben – Ergebnis am Anfang der Liste einfügen, kann zu Problemen bei der Vorauswahl führen.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.hi.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>व्यवस्थापक के रूप में चलाएँ (Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>शीर्ष - सूची के शीर्ष पर परिणाम सम्मिलित करें, पूर्व-चयन समस्या का कारण हो सकता है।</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>Esegui come amministratore (Ctrl+Maiusc+Invio)</value>
</data>
<data name="Top" xml:space="preserve">
<value>In alto: inserire il risultato in cima all'elenco, potrebbe causare problemi di preselezione.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>管理者として実行(Ctrl + Shift + Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>トップ-リストの一番上に結果を挿入します。事前選択の問題が発生する可能性があります。</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.ko.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>관리자 권한으로 실행(Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>상단 - 목록 상단에 결과를 삽입하면 사전 선택 문제가 발생할 수 있습니다.</value>
</data>
</root>
6 changes: 3 additions & 3 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
<data name="Preview" xml:space="preserve">
<value>Preview - Preview file content as icon, may cause freezing if file is not local.</value>
</data>
<data name="RegEx" xml:space="preserve">
<value>RegEx - Enable regular expression in search.</value>
</data>
<data name="run_as_admin" xml:space="preserve">
<value>Run as administrator (Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>Top - Insert result at the top of the list, may cause pre-selection issue.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.ro.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>Rulați ca administrator (Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>Sus - Introduceți rezultatul în partea de sus a listei, poate cauza probleme de preselecție.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.sv.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>Kör som administratör (Ctrl+Skift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>Topp - Infoga resultat högst upp i listan, kan orsaka förvalsproblem.</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.zh-cn.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>以管理员身份运行 (Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>顶部 - 在列表顶部插入结果,可能会导致预选问题</value>
</data>
</root>
3 changes: 0 additions & 3 deletions Properties/Resources.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,4 @@
<data name="run_as_admin" xml:space="preserve">
<value>以系統管理員身分執行 (Ctrl+Shift+Enter)</value>
</data>
<data name="Top" xml:space="preserve">
<value>至頂 - 將結果至頂, 可能會造成預選結果有誤.</value>
</data>
</root>
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8079e7a

Please sign in to comment.