Skip to content

Commit

Permalink
Resolves #138 #137 #132
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-ycv committed Nov 11, 2024
1 parent 744be80 commit 3c17b31
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
24 changes: 1 addition & 23 deletions Community.PowerToys.Run.Plugin.Everything.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
<None Update="Images\Everything.dark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Everything.ico.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Everything.light.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>True</Pack>
Expand All @@ -108,38 +105,19 @@
<None Update="Images\file.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\find.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\NoIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Warning.dark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Warning.light.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\warning.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="MIT.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="settings.toml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if $(Platform) == ARM64 (&#xD;&#xA;del /Q &quot;$(TargetDir)Everything64.dll&quot;&#xD;&#xA;copy /y &quot;$(TargetDir)EverythingARM64.dll&quot; &quot;$(TargetDir)Everything64.dll&quot;&#xD;&#xA;)&#xD;&#xA;del /Q &quot;$(TargetDir)EverythingARM64.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)*.pdb&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)PowerToys*.dll&quot;&#xD;&#xA;del /Q &quot;.\bin\$(Platform)_CHECKSUM.txt&quot;&#xD;&#xA;copy /y &quot;LICENSE&quot; &quot;$(TargetDir)LICENSE.txt&quot;&#xD;&#xA;powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-$(Platform).zip -Force&#xD;&#xA;&quot;C:\Program Files (x86)\NSIS\makensis&quot; /Dver=$(Version) /Ddirect=$(TargetDir) /Dplatform=$(Platform) .\NSIS\exeCreator.nsi&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-$(Platform).zip SHA256 &gt;&gt; .\bin\$(Platform)_CHECKSUM.txt&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-$(Platform).exe SHA256 &gt;&gt; .\bin\$(Platform)_CHECKSUM.txt&#xD;&#xA;rd /Q /S &quot;$(TargetDir)&quot;" />
<Exec Command="if $(Platform) == ARM64 (&#xD;&#xA;del /Q &quot;$(TargetDir)Everything64.dll&quot;&#xD;&#xA;copy /y &quot;$(TargetDir)EverythingARM64.dll&quot; &quot;$(TargetDir)Everything64.dll&quot;&#xD;&#xA;)&#xD;&#xA;rmdir /S /Q &quot;$(TargetDir)amd64&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)TraceReloggerLib.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)EverythingARM64.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)Dia2Lib.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)*.pdb&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)PowerToys*.dll&quot;&#xD;&#xA;del /Q &quot;.\bin\$(Platform)_CHECKSUM.txt&quot;&#xD;&#xA;copy /y &quot;LICENSE&quot; &quot;$(TargetDir)LICENSE.txt&quot;&#xD;&#xA;powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-$(Platform).zip -Force&#xD;&#xA;&quot;C:\Program Files (x86)\NSIS\makensis&quot; /Dver=$(Version) /Ddirect=$(TargetDir) /Dplatform=$(Platform) .\NSIS\exeCreator.nsi&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-$(Platform).zip SHA256 &gt;&gt; .\bin\$(Platform)_CHECKSUM.txt&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-$(Platform).exe SHA256 &gt;&gt; .\bin\$(Platform)_CHECKSUM.txt&#xD;&#xA;rd /Q /S &quot;$(TargetDir)&quot;" />
</Target>

</Project>
14 changes: 11 additions & 3 deletions Everything.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.InteropServices;
using Community.PowerToys.Run.Plugin.Everything.Properties;
using Wox.Plugin;
using Wox.Plugin.Logger;
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;

namespace Community.PowerToys.Run.Plugin.Everything
Expand Down Expand Up @@ -33,7 +34,9 @@ internal void UpdateSettings(Settings setting)
else if (string.IsNullOrEmpty(exe))
{
exe = Path.Exists("C:\\Program Files\\Everything 1.5a\\Everything64.exe") ? "C:\\Program Files\\Everything 1.5a\\Everything64.exe" :
(Path.Exists("C:\\Program Files\\Everything\\Everything.exe") ? "C:\\Program Files\\Everything\\Everything.exe" : string.Empty);
(Path.Exists("C:\\Program Files\\Everything\\Everything.exe") ? "C:\\Program Files\\Everything\\Everything.exe" :
(Path.Exists("C:\\Program Files (x86)\\Everything 1.5a\\Everything.exe") ? "C:\\Program Files (x86)\\Everything 1.5a\\Everything.exe" :
(Path.Exists("C:\\Program Files (x86)\\Everything\\Everything.exe") ? "C:\\Program Files (x86)\\Everything\\Everything.exe" : string.Empty)));
}
}

Expand Down Expand Up @@ -65,7 +68,7 @@ internal IEnumerable<Result> Query(string query, Settings setting)
#endif
}

if (orgqry.Contains(':'))
if (Everything_GetMinorVersion() < 5 && orgqry.Contains(':'))
{
foreach (var kv in setting.Filters)
{
Expand Down Expand Up @@ -109,7 +112,7 @@ internal IEnumerable<Result> Query(string query, Settings setting)
using var process = new Process();
process.StartInfo.FileName = exe;
process.StartInfo.UseShellExecute = true;
process.StartInfo.Arguments = $@"-s {query}";
process.StartInfo.Arguments = $@"-s ""{query.Replace("\"", "\"\"\"")}""";
try
{
process.Start();
Expand All @@ -134,6 +137,11 @@ internal IEnumerable<Result> Query(string query, Settings setting)
#endif
string name = Marshal.PtrToStringUni(Everything_GetResultFileNameW(i));
string path = Marshal.PtrToStringUni(Everything_GetResultPathW(i));
if (name == null || path == null)
{
Log.Warn($"Result {i} is null for {name} and/or {path}, query: {query}", GetType());
continue;
}
string fullPath = Path.Combine(path, name);
#if DEBUG
if (setting.Log > LogLevel.None)
Expand Down
2 changes: 2 additions & 0 deletions Interop/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ internal enum AssocStr
[DllImport(dllName)]
internal static extern uint Everything_GetMax();
[DllImport(dllName)]
internal static extern uint Everything_GetMinorVersion();
[DllImport(dllName)]
internal static extern bool Everything_GetRegex();
[DllImport(dllName, CharSet = CharSet.Unicode)]
internal static extern IntPtr Everything_GetResultFileNameW(uint nIndex);
Expand Down
4 changes: 2 additions & 2 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void Init(PluginInitContext context)
{
if (_setting.Updates)
Task.Run(() => new Update().UpdateAsync(Assembly.GetExecutingAssembly().GetName().Version, _setting));
_setting.Getfilters();
if (Everything_GetMinorVersion() < 5) _setting.Getfilters();
_everything = new Everything(_setting);
_contextMenuLoader = new ContextMenuLoader(context, _setting.Context);
_contextMenuLoader.Update(_setting);
Expand Down Expand Up @@ -225,7 +225,7 @@ public List<Result> Query(Query query, bool delayedExecution)
Debugger.Write($"Everything Exception: {e.Message}\r\n{e.StackTrace}\r\n");
#endif

Log.Exception("Everything Exception: {e.Message}\r\n{e.StackTrace}\r\n", e, GetType());
Log.Exception($"Everything Exception: {e.Message}\r\n{e.StackTrace}\r\n", e, GetType());
}
}

Expand Down
1 change: 1 addition & 0 deletions Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Settings
public Dictionary<string, string> Filters { get; } = [];
internal void Getfilters()
{
Log.Info("User on Everything 1.4", GetType());
#if DEBUG
if (Log > LogLevel.None)
Debugger.Write("2.Getting Filters...");
Expand Down
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.85.1",
"Version": "0.86.0",
"Language": "csharp",
"Website": "https://github.com/Lin-ycv/EverythingPowerToys",
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",
Expand Down
1 change: 1 addition & 0 deletions settings.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file is for Everything 1.4 support, if you're using 1.5a or above, this file fill have no effect
# Lines starting with # are comments
# Search filters, filters result with extension type, seperated by ;
Audio: = ext:aac;ac3;aif;aifc;aiff;amr;ape;au;cda;dts;fla;flac;it;m1a;m2a;m3u;m4a;m4b;m4p;mid;midi;mka;mod;mp2;mp3;mpa;ogg;opus;ra;rmi;spc;rmi;snd;umx;voc;wav;weba;wma;xm;
Expand Down

0 comments on commit 3c17b31

Please sign in to comment.