Updated to match 0.85.1
Fixed translations, removed redundant
Remove debug feature from release
This commit is contained in:
Lin Yu-Chieh (Victor) 2024-10-13 01:04:46 +08:00
parent 7ab6c861c8
commit 8f1e839b12
17 changed files with 334 additions and 213 deletions

View File

@ -1,142 +1,145 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Version.props" />
<!-- Look at Directory.Build.props in root for common stuff as well -->
<Import Project="..\..\..\..\Common.Dotnet.CsWinRT.props" />
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<LangVersion>12</LangVersion>
<ProjectGuid>{64467D32-4786-4ADD-9B77-FBF3C965D3D1}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.PowerToys.Run.Plugin.Everything</RootNamespace>
<AssemblyName>Community.PowerToys.Run.Plugin.Everything</AssemblyName>
<Version>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)plugin.json').Split(',')[5].Split(':')[1].Trim().Trim('"'))</Version>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
<Company>lin-ycv</Company>
<Copyright>Copyright (C) lin-ycv</Copyright>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<useWPF>true</useWPF>
</PropertyGroup>
<PropertyGroup>
<LangVersion>12</LangVersion>
<ProjectGuid>{64467D32-4786-4ADD-9B77-FBF3C965D3D1}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.PowerToys.Run.Plugin.Everything</RootNamespace>
<AssemblyName>Community.PowerToys.Run.Plugin.Everything</AssemblyName>
<Version>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)plugin.json').Split(',')[5].Split(':')[1].Trim().Trim('"'))</Version>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\$(Platform)\$(Configuration)\Everything\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<useWPF>true</useWPF>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
<Company>lin-ycv</Company>
<Copyright>Copyright (C) lin-ycv</Copyright>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>TRACE</DefineConstants>
<OutputPath>bin\$(Platform)\$(Configuration)\Everything\</OutputPath>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\$(Platform)\$(Configuration)\Everything\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<DefineConstants>$(DefineConstants);X64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>TRACE</DefineConstants>
<OutputPath>bin\$(Platform)\$(Configuration)\Everything\</OutputPath>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
<DefineConstants>$(DefineConstants);ARM64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<DefineConstants>$(DefineConstants);X64</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Remove="NativeMethods.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
<DefineConstants>$(DefineConstants);ARM64</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Remove="NativeMethods.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj">
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.es-es.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.de-de.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.zh-cn.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.zh-tw.resx">
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Everything64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="EverythingARM64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<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>
<PackagePath>\</PackagePath>
</None>
<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>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.es-es.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.de-de.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.zh-cn.resx">
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.zh-tw.resx">
</EmbeddedResource>
</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;$(TargetDir)Wox*.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)Ijwhost.dll&quot;&#xD;&#xA;del /Q &quot;$(TargetDir)*.xml&quot;&#xD;&#xA;del/ Q &quot;$(TargetDir)backup_restore_settings.json&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;&#xD;&#xA;rd /Q /S &quot;$(ProjectDir)obj&quot;" />
</Target>
<ItemGroup>
<None Update="Everything64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="EverythingARM64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<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>
<PackagePath>\</PackagePath>
</None>
<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;" />
</Target>
</Project>

View File

@ -1,7 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Security.AccessControl;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
@ -21,10 +25,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
private bool _swapCopy;
private string _options = options;
private string _customProgram;
private string _customArg;
internal void Update(Settings s)
{
_swapCopy = s.Copy;
_options = s.Context;
_customProgram = s.CustomProgram;
_customArg = s.CustomArg;
}
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
@ -214,6 +222,35 @@ namespace Community.PowerToys.Run.Plugin.Everything
},
});
break;
case '6':
// Pass to custom program as parameter
contextMenus.Add(new ContextMenuResult
{
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
Title = Resources.open_in_custom,
Glyph = "\xE8A7",
FontFamily = "Segoe MDL2 Assets",
AcceleratorKey = Key.N,
AcceleratorModifiers = ModifierKeys.Control,
Action = (context) =>
{
using var process = new Process();
process.StartInfo.FileName = _customProgram;
process.StartInfo.Arguments = $"\"{_customArg.Replace("$P", record.Path)}\"";
try
{
process.Start();
return true;
}
catch (Exception e)
{
Log.Exception($"Failed to execute {_customProgram} with arguments {_customArg}", e, GetType());
return false;
}
},
});
break;
default:
break;
}

View File

@ -1,4 +1,5 @@
using System;
#if DEBUG
using System;
using System.IO;
namespace Community.PowerToys.Run.Plugin.Everything
{
@ -12,3 +13,4 @@ namespace Community.PowerToys.Run.Plugin.Everything
}
}
}
#endif

View File

@ -33,12 +33,13 @@ namespace Community.PowerToys.Run.Plugin.Everything
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\\Everything64.exe") ? "C:\\Program Files\\Everything\\Everything64.exe" : string.Empty);
(Path.Exists("C:\\Program Files\\Everything\\Everything.exe") ? "C:\\Program Files\\Everything\\Everything.exe" : string.Empty);
}
}
internal IEnumerable<Result> Query(string query, Settings setting)
{
#if DEBUG
if (setting.Log > LogLevel.None)
{
Debugger.Write($"\r\n\r\nNew Query: {query}\r\n" +
@ -48,6 +49,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
$"Match Path {setting.MatchPath}_{Everything_GetMatchPath()} | " +
$"Regex {setting.RegEx}_{Everything_GetRegex()}");
}
#endif
if (!string.IsNullOrEmpty(setting.Prefix))
query = setting.Prefix + query;
@ -57,8 +59,10 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (setting.EnvVar && orgqry.Contains('%'))
{
query = Environment.ExpandEnvironmentVariables(query).Replace(';', '|');
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write($"EnvVariable\r\n{query}");
#endif
}
if (orgqry.Contains(':'))
@ -68,8 +72,10 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (query.Contains(kv.Key, StringComparison.OrdinalIgnoreCase))
{
query = query.Replace(kv.Key, kv.Value);
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write($"Contains Filter: {kv.Key}\r\n{query}");
#endif
}
}
}
@ -77,15 +83,18 @@ namespace Community.PowerToys.Run.Plugin.Everything
Everything_SetSearchW(query);
if (!Everything_QueryW(true))
{
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write("\r\nUnable to Query\r\n");
#endif
throw new Win32Exception("Unable to Query");
}
uint resultCount = Everything_GetNumResults();
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write($"Results: {resultCount}");
#endif
bool showMore = setting.ShowMore && !string.IsNullOrEmpty(exe) && resultCount == setting.Max;
if (showMore)
@ -119,23 +128,25 @@ namespace Community.PowerToys.Run.Plugin.Everything
for (uint i = 0; i < resultCount; i++)
{
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write($"\r\n===== RESULT #{i} =====");
#endif
string name = Marshal.PtrToStringUni(Everything_GetResultFileNameW(i));
string path = Marshal.PtrToStringUni(Everything_GetResultPathW(i));
string fullPath = Path.Combine(path, name);
#if DEBUG
if (setting.Log > LogLevel.None)
Debugger.Write($"{fullPath.Length} {(setting.Log == LogLevel.Verbose ? fullPath : string.Empty)}");
#endif
bool isFolder = Everything_IsFolderResult(i);
if (isFolder)
path = fullPath;
string ext = Path.GetExtension(fullPath.Replace(".lnk", string.Empty));
#if DEBUG
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}");
#endif
var r = new Result()
{
Title = name,

30
Main.cs
View File

@ -66,6 +66,22 @@ namespace Community.PowerToys.Run.Plugin.Everything
TextValue = _setting.EverythingPath,
},
new()
{
Key = nameof(Settings.CustomProgram),
DisplayLabel = Resources.CustomProgram,
DisplayDescription = Resources.CustomProgram_Description,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox,
TextValue = _setting.CustomProgram,
},
new()
{
Key = nameof(Settings.CustomArg),
DisplayLabel = Resources.CustomArg,
DisplayDescription = Resources.CustomArg_Description,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox,
TextValue = _setting.CustomArg,
},
new()
{
Key = nameof(Settings.Copy),
DisplayLabel = Resources.SwapCopy,
@ -121,6 +137,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
DisplayDescription = $"v{Assembly.GetExecutingAssembly().GetName().Version}",
Value = _setting.Updates,
},
#if DEBUG
new()
{
Key = nameof(Settings.Log),
@ -129,6 +146,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
ComboBoxItems = Enum.GetValues(typeof(LogLevel)).Cast<int>().Select(d => new KeyValuePair<string, string>(((LogLevel)d).ToString(), d + string.Empty)).ToList(),
ComboBoxValue = (int)_setting.Log,
},
#endif
];
public void Init(PluginInitContext context)
@ -139,8 +157,10 @@ namespace Community.PowerToys.Run.Plugin.Everything
_everything = new Everything(_setting);
_contextMenuLoader = new ContextMenuLoader(context, _setting.Context);
_contextMenuLoader.Update(_setting);
#if DEBUG
if (_setting.Log > LogLevel.None)
Debugger.Write("Init Complete\r\n");
#endif
}
public void UpdateSettings(PowerLauncherPluginSettings settings)
@ -157,10 +177,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
_setting.QueryText = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.QueryText)).Value;
_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;
_setting.EverythingPath = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.EverythingPath)).TextValue;
_setting.CustomProgram = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.CustomProgram)).TextValue;
_setting.CustomArg = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.CustomArg)).TextValue;
_setting.ShowMore = settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.ShowMore)).Value;
#if DEBUG
_setting.Log = (LogLevel)settings.AdditionalOptions.FirstOrDefault(x => x.Key == nameof(_setting.Log)).ComboBoxValue;
#endif
_everything?.UpdateSettings(_setting);
_contextMenuLoader?.Update(_setting);
@ -196,10 +220,12 @@ namespace Community.PowerToys.Run.Plugin.Everything
}
catch (Exception e)
{
#if DEBUG
if (_setting.Log > LogLevel.None)
Debugger.Write($"Everything Exception: {e.Message}\r\n{e.StackTrace}\r\n");
#endif
Log.Exception("Everything Exception", e, GetType());
Log.Exception("Everything Exception: {e.Message}\r\n{e.StackTrace}\r\n", e, GetType());
}
}

View File

@ -80,7 +80,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
/// <summary>
/// Looks up a localized string similar to Configure context menu options and order.
///0_Open folder, 1_Run as Admin, 2_Run as User, 3_Copy, 4_Copy Path, 5_Open in Console.
///0_Open folder, 1_Run as Admin, 2_Run as User, 3_Copy, 4_Copy Path, 5_Open in Console, 6_Open in custom program.
/// </summary>
public static string Context_Description {
get {
@ -124,6 +124,42 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Launch argument.
/// </summary>
public static string CustomArg {
get {
return ResourceManager.GetString("CustomArg", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Argument to pass to the program when launching. [$P=path of the selected result ].
/// </summary>
public static string CustomArg_Description {
get {
return ResourceManager.GetString("CustomArg_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom Program.
/// </summary>
public static string CustomProgram {
get {
return ResourceManager.GetString("CustomProgram", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path to a external program that&apos;ll open the selected result.
/// </summary>
public static string CustomProgram_Description {
get {
return ResourceManager.GetString("CustomProgram_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enviroment Variables.
/// </summary>
@ -170,7 +206,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
/// <summary>
/// Looks up a localized string similar to Location of Everything64.exe if it&apos;s not installed in &quot;Program Files&quot;.
/// Looks up a localized string similar to Location of Everything.exe if it&apos;s not installed in &quot;Program Files&quot;.
/// </summary>
public static string EverythingPath_Description {
get {
@ -259,6 +295,15 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Open path in custom program (Ctrl+N).
/// </summary>
public static string open_in_custom {
get {
return ResourceManager.GetString("open_in_custom", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Get search results from Everything.
/// </summary>

View File

@ -156,9 +156,6 @@
<data name="plugin_description" xml:space="preserve">
<value>Everything-Suchergebnisse anzeigen</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything</value>
</data>
<data name="Preview" xml:space="preserve">
<value>Vorschau</value>
</data>
@ -171,9 +168,6 @@
<data name="QueryText_Description" xml:space="preserve">
<value>Ausgewählte Ergebnisse können den Abfragetext aktualisieren. Hilft bei der Anzeige zusätzlicher Informationen, kann aber die Anzeigeergebnisse verändern.</value>
</data>
<data name="RegEx" xml:space="preserve">
<value>RegEx</value>
</data>
<data name="RegEx_Description" xml:space="preserve">
<value>Aktiviert reguläre Ausdrücke in der Suche.</value>
</data>
@ -189,4 +183,4 @@
<data name="SwapCopy_Description" xml:space="preserve">
<value>Strg+C zum Kopieren von Dateien/Ordnern, Strg+Alt+C zum Kopieren des Pfades.</value>
</data>
</root>
</root>

View File

@ -133,12 +133,6 @@
<data name="copy_path" xml:space="preserve">
<value>Copiar ruta </value>
</data>
<data name="copy_shortcut" xml:space="preserve">
<value>(Ctrl+C)</value>
</data>
<data name="copy_shortcutAlt" xml:space="preserve">
<value>(Ctrl+Alt+C)</value>
</data>
<data name="EnvVar" xml:space="preserve">
<value>Variables de entorno</value>
</data>
@ -175,9 +169,6 @@
<data name="plugin_description" xml:space="preserve">
<value>Obtener resultados de búsqueda desde Everything</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything</value>
</data>
<data name="Preview" xml:space="preserve">
<value>Vista previa</value>
</data>
@ -190,9 +181,6 @@
<data name="QueryText_Description" xml:space="preserve">
<value>El resultado seleccionado puede actualizar el texto de búsqueda. Ayuda a mostrar información adicional, pero podría cambiar los resultados mostrados.</value>
</data>
<data name="RegEx" xml:space="preserve">
<value>RegEx</value>
</data>
<data name="RegEx_Description" xml:space="preserve">
<value>Permitir expresiones regulares en las búsquedas.
Se recomenda usar expresiones regulares: en la consulta en lugar de habilitar esta opción.</value>

View File

@ -126,12 +126,6 @@
<data name="copy_path" xml:space="preserve">
<value>Copier le chemin </value>
</data>
<data name="copy_shortcut" xml:space="preserve">
<value>(Ctrl+C)</value>
</data>
<data name="copy_shortcutAlt" xml:space="preserve">
<value>(Ctrl+Alt+C)</value>
</data>
<data name="Everything_ini" xml:space="preserve">
<value>Installer Everything s'il n'est pas installé</value>
</data>
@ -156,9 +150,6 @@
<data name="plugin_description" xml:space="preserve">
<value>Afficher les résultats de recherche Everything</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything</value>
</data>
<data name="Preview" xml:space="preserve">
<value>Aperçu</value>
</data>
@ -171,9 +162,6 @@
<data name="QueryText_Description" xml:space="preserve">
<value>Les résultats sélectionnés peuvent mettre à jour le texte de la requête. Aide à afficher des informations supplémentaires, mais peut modifier les résultats de l'affichage. Permet d'afficher des informations supplémentaires, mais peut modifier les résultats de l'affichage.</value>
</data>
<data name="RegEx" xml:space="preserve">
<value>RegEx</value>
</data>
<data name="RegEx_Description" xml:space="preserve">
<value>Active les expressions régulières dans la recherche.</value>
</data>

View File

@ -133,12 +133,6 @@
<data name="copy_path" xml:space="preserve">
<value>Kopiuj ścieżkę </value>
</data>
<data name="copy_shortcut" xml:space="preserve">
<value>(Ctrl+C)</value>
</data>
<data name="copy_shortcutAlt" xml:space="preserve">
<value>(Ctrl+Alt+C)</value>
</data>
<data name="EnvVar" xml:space="preserve">
<value>Zmienne środowiskowe</value>
</data>
@ -175,9 +169,6 @@
<data name="plugin_description" xml:space="preserve">
<value>Pokazuj wyniki wyszukiwania z Everything</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything</value>
</data>
<data name="Preview" xml:space="preserve">
<value>Podgląd</value>
</data>
@ -190,9 +181,6 @@
<data name="QueryText_Description" xml:space="preserve">
<value>Wybrany wynik może zmienić zapytanie. Pomaga wyświetlić dodatkowe informacje, ale może zmienić wyświetlane wyniki.</value>
</data>
<data name="RegEx" xml:space="preserve">
<value>RegEx</value>
</data>
<data name="RegEx_Description" xml:space="preserve">
<value>Włącz wyrażenia regularne w wyszukiwaniu.</value>
</data>
@ -224,4 +212,4 @@ Dostępna: {1}</value>
<data name="Updates" xml:space="preserve">
<value>Sprawdź aktualizacje</value>
</data>
</root>
</root>

View File

@ -125,7 +125,7 @@
</data>
<data name="Context_Description" xml:space="preserve">
<value>Configure context menu options and order.
0_Open folder, 1_Run as Admin, 2_Run as User, 3_Copy, 4_Copy Path, 5_Open in Console</value>
0_Open folder, 1_Run as Admin, 2_Run as User, 3_Copy, 4_Copy Path, 5_Open in Console, 6_Open in custom program</value>
</data>
<data name="copy_file" xml:space="preserve">
<value>Copy </value>
@ -149,7 +149,7 @@
<value>Everything64.exe</value>
</data>
<data name="EverythingPath_Description" xml:space="preserve">
<value>Location of Everything64.exe if it's not installed in "Program Files"</value>
<value>Location of Everything.exe if it's not installed in "Program Files"</value>
</data>
<data name="Everything_ini" xml:space="preserve">
<value>Install Everything if not installed</value>
@ -250,4 +250,19 @@ Latest: {1}</value>
<data name="Updates" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="CustomProgram" xml:space="preserve">
<value>Custom Program</value>
</data>
<data name="CustomProgram_Description" xml:space="preserve">
<value>Path to a external program that'll open the selected result</value>
</data>
<data name="CustomArg" xml:space="preserve">
<value>Launch argument</value>
</data>
<data name="CustomArg_Description" xml:space="preserve">
<value>Argument to pass to the program when launching. [$P=path of the selected result ]</value>
</data>
<data name="open_in_custom" xml:space="preserve">
<value>Open path in custom program (Ctrl+N)</value>
</data>
</root>

View File

@ -120,6 +120,10 @@
<data name="clipboard_failed" xml:space="preserve">
<value>无法设置剪贴板中的文本</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Context" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="Context_Description" xml:space="preserve">
<value>配置选单选项与顺序
0_打开所在文件夹、1_以管理员身分运行、2_以不同的使用者身分运行、3_复制、4_复制路径、5_在控制台中开启</value>
@ -134,7 +138,7 @@
<value>搜索时可以使用环境变量,但会增加搜索时间</value>
</data>
<data name="EverythingPath_Description" xml:space="preserve">
<value>若Everything安装位置非预设的Program Files请提供Everything64exe的位置</value>
<value>若Everything安装位置非预设的Program Files请提供Everything.exe的位置</value>
</data>
<data name="Everything_ini" xml:space="preserve">
<value>是否安装了 Everything?</value>
@ -166,9 +170,6 @@
<data name="plugin_description" xml:space="preserve">
<value>利用 Everything 搜索磁盘文件</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything</value>
</data>
<data name="Prefix_Description" xml:space="preserve">
<value>为搜索词添加固定的前缀,搜索时无需再手动输入修饰词/筛选词
前缀与搜索词之间不会自动加入空格</value>
@ -197,14 +198,14 @@
<data name="SwapCopy_Description" xml:space="preserve">
<value>使用 Ctrl+C 复制档案Ctrl+Alt+C 复制路径</value>
</data>
<data name="Updates" xml:space="preserve">
<value>检查是否有更新</value>
</data>
<data name="UpdatesAvailable" xml:space="preserve">
<data name="UpdateAvailable" xml:space="preserve">
<value>更新EverythingPowerToys吗
点击 '否' 将不再收到有关此版本更新的通知
安装版本:{0}
最新版本:{1}</value>
</data>
<data name="Updates" xml:space="preserve">
<value>检查是否有更新</value>
</data>
</root>

View File

@ -122,7 +122,7 @@
</data>
<data name="Context_Description" xml:space="preserve">
<value>配置選單選項與順序
0_開啟資料夾、1_以管理員身分執行、2_以其他使用者身分執行、3_複製、4_複製路徑、5_在命令提示字元中開啟</value>
0_開啟資料夾、1_以管理員身分執行、2_以其他使用者身分執行、3_複製、4_複製路徑、5_在命令提示字元中開啟、6_在指定軟體中開啟</value>
</data>
<data name="copy_file" xml:space="preserve">
<value>複製</value>
@ -134,7 +134,7 @@
<value>搜尋時可用環境變數,但會增加搜尋時間</value>
</data>
<data name="EverythingPath_Description" xml:space="preserve">
<value>若Everything安裝位置非預設的Program Files請提供Everything64.exe的位置</value>
<value>若Everything安裝位置非預設的Program Files請提供Everything.exe的位置</value>
</data>
<data name="Everything_ini" xml:space="preserve">
<value>是否有安裝 Everything?</value>
@ -166,9 +166,6 @@
<data name="plugin_description" xml:space="preserve">
<value>利用 Everything 搜尋電腦上的檔案</value>
</data>
<data name="plugin_name" xml:space="preserve">
<value>Everything 搜尋</value>
</data>
<data name="Prefix_Description" xml:space="preserve">
<value>為收尋詞增加固定的前綴,在收詢時不用再自行打修飾詞/篩選詞
前綴與收尋詞之間不會自動加入空格</value>
@ -189,8 +186,8 @@
<data name="run_as_user" xml:space="preserve">
<value>以其他使用者身分執行 (Ctrl+Shift+U)</value>
</data>
<data name="ShowMore_Descripton" xml:space="preserve">
<value>顯示一個以用目前搜尋詞打開 Everything的結果</value>
<data name="ShowMore_Description" xml:space="preserve">
<value>在Everything裡顯示剩餘的收尋結果</value>
</data>
<data name="Sort_Description" xml:space="preserve">
<value>設定結果排序方法</value>
@ -198,14 +195,23 @@
<data name="SwapCopy_Description" xml:space="preserve">
<value>使用 Ctrl+C 複製檔案Ctrl+Alt+C 複製路徑</value>
</data>
<data name="Updates" xml:space="preserve">
<value>啟用時檢查是否有更新</value>
</data>
<data name="UpdatesAvailable" xml:space="preserve">
<data name="UpdateAvailable" xml:space="preserve">
<value>更新EverythingPowerToys?
按 '否' 不再通知這版的更新
安裝版本:{0}
最新版本:{1}</value>
</data>
<data name="Updates" xml:space="preserve">
<value>啟用時檢查是否有更新</value>
</data>
<data name="CustomProgram_Description" xml:space="preserve">
<value>要使用的指定軟體路徑</value>
</data>
<data name="CustomArg_Description" xml:space="preserve">
<value>執行參數 [$P=收尋結果路徑]</value>
</data>
<data name="open_in_custom" xml:space="preserve">
<value>在指定軟體裡開起 (Ctrl+N)</value>
</data>
</root>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Wox.Plugin.Logger;
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
namespace Community.PowerToys.Run.Plugin.Everything
@ -11,7 +12,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
// Settings from PTR settings
public Sort Sort { get; set; } = Sort.NAME_ASCENDING;
public uint Max { get; set; } = 10;
public string Context { get; set; } = "012345";
public string Context { get; set; } = "0123456";
public bool Copy { get; set; }
public bool MatchPath { get; set; }
public bool Preview { get; set; } = true;
@ -20,23 +21,32 @@ namespace Community.PowerToys.Run.Plugin.Everything
public bool EnvVar { get; set; }
public bool Updates { get; set; } = true;
public string Skip { get; set; }
public LogLevel Log { get; set; } = LogLevel.None;
public string Prefix { get; set; }
public string EverythingPath { get; set; }
public bool ShowMore { get; set; } = true;
public string CustomProgram { get; set; } = "notepad.exe";
public string CustomArg { get; set; } = "$P";
#if DEBUG
public LogLevel Log { get; set; } = LogLevel.None;
#endif
// Get Filters from settings.toml
public Dictionary<string, string> Filters { get; } = [];
internal void Getfilters()
{
#if DEBUG
if (Log > LogLevel.None)
Debugger.Write("2.Getting Filters...");
#endif
string[] strArr;
try { strArr = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "settings.toml")); }
catch (Exception e)
{
#if DEBUG
if (Log > LogLevel.None)
Debugger.Write($"\r\nERROR: {e.Message}\r\n");
#endif
Log.Error($"Error reading settings.toml: {e.Message}", GetType());
return;
}
@ -49,16 +59,18 @@ namespace Community.PowerToys.Run.Plugin.Everything
if (kv[0].Contains(':'))
Filters.TryAdd(kv[0].ToLowerInvariant(), kv[1] + (kv[1].EndsWith(';') ? ' ' : string.Empty));
}
#if DEBUG
if (Log > LogLevel.None)
Debugger.Write(Log > LogLevel.Debug ? string.Join(Environment.NewLine, Filters) + "\r\n" : string.Empty + " GettingFilters...Done");
#endif
}
}
#if DEBUG
public enum LogLevel
{
None,
Debug,
Verbose,
}
#endif
}

View File

@ -17,18 +17,19 @@ namespace Community.PowerToys.Run.Plugin.Everything
internal async Task UpdateAsync(Version v, Settings s)
{
string apiUrl = "https://api.github.com/repos/lin-ycv/EverythingPowerToys/releases/latest";
#if DEBUG
if (s.Log > LogLevel.None)
Debugger.Write("1.Checking Update...");
#endif
try
{
using HttpClient httpClient = new();
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0");
HttpResponseMessage response = await httpClient.GetAsync(apiUrl);
#if DEBUG
if (s.Log == LogLevel.Verbose) Debugger.Write($"\tResponse: {response.StatusCode}");
#endif
if (response.IsSuccessStatusCode)
{
using JsonDocument jsonDocument = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
@ -79,14 +80,19 @@ namespace Community.PowerToys.Run.Plugin.Everything
}
}
}
#if RELEASE
catch
{ }
#else
catch (Exception e)
{
if (s.Log > LogLevel.None)
Debugger.Write($"\r\nERROR: {e.Message}\r\n{e.StackTrace}\r\n");
}
if (s.Log > LogLevel.None)
Debugger.Write(" Checking Update...Done");
#endif
}
}
}

View File

@ -1 +0,0 @@
folder needs to exist so nsis doesn't complain

View File

@ -4,7 +4,7 @@
"IsGlobal": true,
"Name": "Everything",
"Author": "Yu Chieh (Victor) Lin",
"Version": "0.82.1",
"Version": "0.85.1",
"Language": "csharp",
"Website": "https://github.com/Lin-ycv/EverythingPowerToys",
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",