diff --git a/Community.PowerToys.Run.Plugin.Everything.csproj b/Community.PowerToys.Run.Plugin.Everything.csproj
index 5e26e6f..a576e41 100644
--- a/Community.PowerToys.Run.Plugin.Everything.csproj
+++ b/Community.PowerToys.Run.Plugin.Everything.csproj
@@ -33,6 +33,14 @@
none
+
+ $(DefineConstants);X64
+
+
+
+ $(DefineConstants);ARM64
+
+
@@ -65,23 +73,14 @@
- Community.PowerToys.Run.Plugin.Everything.Language
- Resources.de.Designer.cs
- PublicResXFileCodeGenerator
- Community.PowerToys.Run.Plugin.Everything.Language
- Resources - Copy.zh.Designer.cs
- PublicResXFileCodeGenerator
PublicResXFileCodeGenerator
Resources.Designer.cs
-
- Community.PowerToys.Run.Plugin.Everything.Language
- Resources.zh.Designer.cs
- PublicResXFileCodeGenerator
+
@@ -137,7 +136,7 @@
-
+
diff --git a/Everything.cs b/Everything.cs
index 304b16c..72f0215 100644
--- a/Everything.cs
+++ b/Everything.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
+using System.Runtime.InteropServices;
using Community.PowerToys.Run.Plugin.Everything.Properties;
using Wox.Plugin;
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
@@ -13,7 +14,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
{
internal Everything(Settings setting)
{
- Everything_SetRequestFlags(Request.FULL_PATH_AND_FILE_NAME);
+ Everything_SetRequestFlags(Request.FILE_NAME | Request.PATH);
UpdateSettings(setting);
}
@@ -30,14 +31,18 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (setting.Log > LogLevel.None)
{
Debugger.Write($"\r\n\r\nNew Query: {query}\r\n" +
+ $"Prefix {setting.Prefix} | " +
$"Sort {(int)setting.Sort}_{Everything_GetSort()} | " +
$"Max {setting.Max}_{Everything_GetMax()} | " +
$"Match Path {setting.MatchPath}_{Everything_GetMatchPath()} | " +
$"Regex {setting.RegEx}_{Everything_GetRegex()}");
}
+ if (!string.IsNullOrEmpty(setting.Prefix))
+ query = setting.Prefix + query;
+
string orgqry = query;
-
+
if (setting.EnvVar && orgqry.Contains('%'))
{
query = Environment.ExpandEnvironmentVariables(query).Replace(';', '|');
@@ -76,16 +81,16 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (setting.Log > LogLevel.None)
Debugger.Write($"\r\n===== RESULT #{i} =====");
- char[] buffer = new char[32767];
- uint length = Everything_GetResultFullPathNameW(i, buffer, (uint)buffer.Length);
+ string name = Marshal.PtrToStringUni(Everything_GetResultFileNameW(i));
+ string path = Marshal.PtrToStringUni(Everything_GetResultPathW(i));
+ string fullPath = Path.Combine(path, name);
- string fullPath = new(buffer, 0, (int)length);
if (setting.Log > LogLevel.None)
- Debugger.Write($"{length} {(setting.Log == LogLevel.Verbose ? fullPath : string.Empty)}");
- string name = Path.GetFileName(fullPath);
- bool isFolder = Everything_IsFolderResult(i);
+ Debugger.Write($"{fullPath.Length} {(setting.Log == LogLevel.Verbose ? fullPath : string.Empty)}");
- string path = isFolder ? fullPath : Path.GetDirectoryName(fullPath);
+ bool isFolder = Everything_IsFolderResult(i);
+ if (isFolder)
+ path = fullPath;
string ext = Path.GetExtension(fullPath.Replace(".lnk", string.Empty));
if (setting.Log > LogLevel.None)
Debugger.Write($"Folder: {isFolder}\r\nFile Path {(setting.Log == LogLevel.Verbose ? path : path.Length)}\r\nFile Name {(setting.Log == LogLevel.Verbose ? name : name.Length)}\r\nExt: {ext}");
@@ -114,7 +119,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
try
{
process.Start();
- _ = Everything_IncRunCountFromFileNameW(fullPath);
+ _ = Everything_IncRunCountFromFileName(fullPath);
return true;
}
catch (Win32Exception)
diff --git a/GlobalSuppressions.cs b/GlobalSuppressions.cs
index 85d842b..3fa323f 100644
--- a/GlobalSuppressions.cs
+++ b/GlobalSuppressions.cs
@@ -13,3 +13,5 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "Reviewed")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1636:FileHeaderCopyrightTextMustMatch", Justification = "Reviewed.")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "Reviewed")]
+[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "Reviewed")]
+[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "Reviewed")]
diff --git a/Interop/NativeMethods.cs b/Interop/NativeMethods.cs
index a2d6cba..601676f 100644
--- a/Interop/NativeMethods.cs
+++ b/Interop/NativeMethods.cs
@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace Community.PowerToys.Run.Plugin.Everything.Interop
{
- public sealed partial class NativeMethods
+ public sealed class NativeMethods
{
#region FlagsEnums
[Flags]
@@ -106,40 +106,38 @@ namespace Community.PowerToys.Run.Plugin.Everything.Interop
}
#endregion
internal const string dllName = "Everything64.dll";
- [LibraryImport(dllName)]
- internal static partial uint Everything_GetNumResults();
- [LibraryImport(dllName)]
+ [DllImport(dllName)]
+ internal static extern uint Everything_GetNumResults();
+ [DllImport(dllName)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static partial bool Everything_GetMatchPath();
- [LibraryImport(dllName)]
- internal static partial uint Everything_GetMax();
- [LibraryImport(dllName)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static partial bool Everything_GetRegex();
- [LibraryImport(dllName, StringMarshalling = StringMarshalling.Utf16)]
- internal static partial uint Everything_GetResultFullPathNameW(uint nIndex, [Out] char[] lpString, uint nMaxCount);
- [LibraryImport(dllName)]
- internal static partial uint Everything_GetSort();
- [LibraryImport(dllName, StringMarshalling = StringMarshalling.Utf16)]
- internal static partial uint Everything_IncRunCountFromFileNameW(string lpFileName);
- [LibraryImport(dllName)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static partial bool Everything_IsFolderResult(uint index);
- [LibraryImport(dllName)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static partial bool Everything_QueryW([MarshalAs(UnmanagedType.Bool)] bool bWait);
- [LibraryImport(dllName)]
- internal static partial void Everything_SetMax(uint dwMax);
- [LibraryImport(dllName)]
- internal static partial void Everything_SetRegex([MarshalAs(UnmanagedType.Bool)] bool bEnable);
- [LibraryImport(dllName)]
- internal static partial void Everything_SetRequestFlags(Request RequestFlags);
- [LibraryImport(dllName, StringMarshalling = StringMarshalling.Utf16)]
- internal static partial void Everything_SetSearchW(string lpSearchString);
- [LibraryImport(dllName)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static partial bool Everything_SetMatchPath([MarshalAs(UnmanagedType.Bool)] bool bEnable);
- [LibraryImport(dllName)]
- internal static partial void Everything_SetSort(Sort SortType);
+ internal static extern bool Everything_GetMatchPath();
+ [DllImport(dllName)]
+ internal static extern uint Everything_GetMax();
+ [DllImport(dllName)]
+ internal static extern bool Everything_GetRegex();
+ [DllImport(dllName, CharSet = CharSet.Unicode)]
+ internal static extern IntPtr Everything_GetResultFileNameW(uint nIndex);
+ [DllImport(dllName, CharSet = CharSet.Unicode)]
+ internal static extern IntPtr Everything_GetResultPathW(uint nIndex);
+ [DllImport(dllName)]
+ internal static extern uint Everything_GetSort();
+ [DllImport(dllName, CharSet = CharSet.Unicode)]
+ internal static extern uint Everything_IncRunCountFromFileName(string lpFileName);
+ [DllImport(dllName)]
+ internal static extern bool Everything_IsFolderResult(uint index);
+ [DllImport(dllName)]
+ internal static extern bool Everything_QueryW([MarshalAs(UnmanagedType.Bool)] bool bWait);
+ [DllImport(dllName)]
+ internal static extern void Everything_SetMax(uint dwMax);
+ [DllImport(dllName)]
+ internal static extern void Everything_SetRegex([MarshalAs(UnmanagedType.Bool)] bool bEnable);
+ [DllImport(dllName)]
+ internal static extern void Everything_SetRequestFlags(Request RequestFlags);
+ [DllImport(dllName, CharSet = CharSet.Unicode)]
+ internal static extern void Everything_SetSearchW(string lpSearchString);
+ [DllImport(dllName)]
+ internal static extern bool Everything_SetMatchPath([MarshalAs(UnmanagedType.Bool)] bool bEnable);
+ [DllImport(dllName)]
+ internal static extern void Everything_SetSort(Sort SortType);
}
}
diff --git a/Main.cs b/Main.cs
index 2654bb0..15452ef 100644
--- a/Main.cs
+++ b/Main.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Reflection;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Controls;
using Community.PowerToys.Run.Plugin.Everything.Properties;
@@ -19,10 +17,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
public static string PluginID => "A86867E2D932459CBD77D176373DD657";
public string Name => Resources.plugin_name;
public string Description => Resources.plugin_description;
-
private readonly Settings _setting = new();
private Everything _everything;
-
private ContextMenuLoader _contextMenuLoader;
private bool _disposed;
@@ -54,6 +50,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
NumberValue = _setting.Max,
},
new()
+ {
+ Key = nameof(Settings.Prefix),
+ DisplayLabel = Resources.Prefix,
+ DisplayDescription = Resources.Prefix_Description,
+ PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox,
+ TextValue = _setting.Prefix,
+ },
+ new()
{
Key = nameof(Settings.Copy),
DisplayLabel = Resources.SwapCopy,
@@ -112,33 +116,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
},
];
- private void CheckArm()
- {
- string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
- arm = Path.Combine(dir, "EverythingARM64.dll");
- if (File.Exists(arm))
- {
- Architecture arch = RuntimeInformation.ProcessArchitecture;
- if (_setting.Log > LogLevel.None)
- Debugger.Write("0.Checking ARM..." + (_setting.Log == LogLevel.Verbose ? $"\r\n\tArchitecture: {arch}" : string.Empty));
- if (arch == Architecture.Arm64)
- {
- File.Delete(Path.Combine(dir, "Everything64.dll"));
- File.Move(arm, Path.Combine(dir, "Everything64.dll"));
- }
- else
- {
- File.Delete(arm);
- }
- }
-
- if (_setting.Log > LogLevel.None)
- Debugger.Write(" Checking ARM...Done");
- }
-
public void Init(PluginInitContext context)
{
- CheckArm();
if (_setting.Updates)
Task.Run(() => new Update().UpdateAsync(Assembly.GetExecutingAssembly().GetName().Version, _setting));
_setting.Getfilters();
@@ -164,6 +143,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
_setting.EnvVar = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.EnvVar)).Value;
_setting.Updates = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.Updates)).Value;
_setting.Log = (LogLevel)settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.Log)).ComboBoxValue;
+ _setting.Prefix = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.Prefix)).TextValue;
_everything?.UpdateSettings(_setting);
_contextMenuLoader?.Update(_setting);
@@ -229,10 +209,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
}
public List LoadContextMenus(Result selectedResult) => _contextMenuLoader.LoadContextMenus(selectedResult);
-
public Control CreateSettingPanel() => throw new NotImplementedException();
public string GetTranslatedPluginTitle() => Resources.plugin_name;
-
public string GetTranslatedPluginDescription() => Resources.plugin_description;
}
}
diff --git a/NSIS/exeCreator.nsi b/NSIS/exeCreator.nsi
index 4dcf438..498ef20 100644
--- a/NSIS/exeCreator.nsi
+++ b/NSIS/exeCreator.nsi
@@ -1,11 +1,10 @@
; Silent switch /S
-; to check silent mode `start /wait EverythingPT-0.81.0-x64+ARM64.exe /S`
+; to check silent mode `start /wait EverythingPT-0.81.0-x64.exe /S`
; and `echo %ERRORLEVEL%` to check if 0 or 2
-; Pass in /Dver=0.00.0 /Ddirect=(TargetDir) before calling the script to set the version
+; Pass in /Dver=0.00.0 /Ddirect=$(TargetDir) before calling the script to set the version
; ie: makensis /Dver=0.77.0 /Ddirect=bin\x64\Release\Everything\ .\exeCreator.nsi
; Doc: https://nsis.sourceforge.io/Docs/Chapter4.html
!define EPT "EverythingPT"
-!define PT "PowerToys.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
;--------------------------------
@@ -25,7 +24,7 @@ FileErrorText "Can't write: $\r$\n$\r$\n$0$\r$\n$\r$\nPowerToys is probably stil
Icon Everything.ico
InstallDir "$LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\Everything"
Name "${EPT}"
-OutFile ".\..\bin\${EPT}-${ver}-x64+ARM64.exe"
+OutFile ".\..\bin\${EPT}-${ver}-${platform}.exe"
RequestExecutionLevel user
SetCompressor /SOLID /FINAL lzma
LicenseData "MIT.txt"
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index dd070a3..6965e59 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -134,7 +134,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
///
- /// Looks up a localized string similar to Expanded enviroment variables, such as %appdata%, so that they work properly at the cost of query time..
+ /// Looks up a localized string similar to Expand enviroment variables, such as %appdata%, so that they work properly at the cost of query time..
///
public static string EnvVar_Description {
get {
@@ -241,6 +241,25 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Query Prefix.
+ ///
+ public static string Prefix {
+ get {
+ return ResourceManager.GetString("Prefix", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Adds prefix to all queries, so that you can always include certain filters/modifiers without typing it every time.
+ ///Space is not added automatically between prfix and query..
+ ///
+ public static string Prefix_Description {
+ get {
+ return ResourceManager.GetString("Prefix_Description", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Preview.
///
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 352a328..bbfe23a 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -143,7 +143,7 @@
Enviroment Variables
- Expanded enviroment variables, such as %appdata%, so that they work properly at the cost of query time.
+ Expand enviroment variables, such as %appdata%, so that they work properly at the cost of query time.
Install Everything if not installed
@@ -178,6 +178,13 @@
Everything
+
+ Query Prefix
+
+
+ Adds prefix to all queries, so that you can always include certain filters/modifiers without typing it every time.
+Space is not added automatically between prfix and query.
+
Preview
diff --git a/Properties/Resources.zh-cn.resx b/Properties/Resources.zh-cn.resx
index b835b61..0b3844d 100644
--- a/Properties/Resources.zh-cn.resx
+++ b/Properties/Resources.zh-cn.resx
@@ -191,4 +191,4 @@
安装版本:{0}
最新版本:{1}
-
+
\ No newline at end of file
diff --git a/Properties/Resources.zh.resx b/Properties/Resources.zh-tw.resx
similarity index 96%
rename from Properties/Resources.zh.resx
rename to Properties/Resources.zh-tw.resx
index 5a5ca6c..5eeaa3b 100644
--- a/Properties/Resources.zh.resx
+++ b/Properties/Resources.zh-tw.resx
@@ -146,7 +146,7 @@
也收尋路徑
- 結果中顯示的最大結果數
+ 結果中顯示的結果數上限
開啟檔案位置 (Ctrl+Shift+E)
@@ -160,6 +160,10 @@
Everything 搜尋
+
+ 為收尋詞增加固定的前綴,在收詢時不用再自行打修飾詞/篩選詞
+前綴與收尋詞之間不會自動加入空格
+
將檔案內容顯示為預覽圖示,預覽雲端的檔案可能會造成停頓
@@ -174,7 +178,7 @@
以系統管理員身分執行 (Ctrl+Shift+Enter)
- 以其他使用者身份執行 (Ctrl+Shift+U)
+ 以其他使用者身分執行 (Ctrl+Shift+U)
設定結果排序方法
diff --git a/Settings.cs b/Settings.cs
index 8eb4d86..736442b 100644
--- a/Settings.cs
+++ b/Settings.cs
@@ -21,6 +21,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
public bool Updates { get; set; } = true;
public string Skip { get; set; }
public LogLevel Log { get; set; } = LogLevel.None;
+ public string Prefix { get; set; }
// Get Filters from settings.toml
public Dictionary Filters { get; } = [];
diff --git a/Update.cs b/Update.cs
index f74d2d0..d421098 100644
--- a/Update.cs
+++ b/Update.cs
@@ -44,7 +44,11 @@ namespace Community.PowerToys.Run.Plugin.Everything
string[] nameUrl = [string.Empty, string.Empty];
foreach (JsonElement asset in assets.EnumerateArray())
{
- if (asset.TryGetProperty("browser_download_url", out JsonElement downUrl) && downUrl.ToString().EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
+#if X64
+ if (asset.TryGetProperty("browser_download_url", out JsonElement downUrl) && downUrl.ToString().EndsWith("x64.exe", StringComparison.OrdinalIgnoreCase))
+#elif ARM64
+ if (asset.TryGetProperty("browser_download_url", out JsonElement downUrl) && downUrl.ToString().EndsWith("ARM64.exe", StringComparison.OrdinalIgnoreCase))
+#endif
{
nameUrl[0] = asset.GetProperty("name").ToString();
nameUrl[1] = downUrl.ToString();
@@ -81,7 +85,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
Debugger.Write($"\r\nERROR: {e.Message}\r\n{e.StackTrace}\r\n");
}
- Debugger.Write(" Checking Update...Done");
+ if (s.Log > LogLevel.None)
+ Debugger.Write(" Checking Update...Done");
}
}
}
diff --git a/plugin.json b/plugin.json
index f1022da..7fed271 100644
--- a/plugin.json
+++ b/plugin.json
@@ -4,7 +4,7 @@
"IsGlobal": true,
"Name": "Everything",
"Author": "Yu Chieh (Victor) Lin",
- "Version": "0.81.0.1",
+ "Version": "0.82.0",
"Language": "csharp",
"Website": "https://github.com/Lin-ycv/EverythingPowerToys",
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",