mirror of
https://github.com/lin-ycv/EverythingPowerToys.git
synced 2025-01-09 04:17:47 +08:00
parent
0f5c9b177c
commit
e583ebf872
@ -2,7 +2,7 @@
|
||||
<Import Project="..\..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<ProjectGuid>{64467D32-4786-4ADD-9B77-FBF3C965D3D1}</ProjectGuid>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Community.PowerToys.Run.Plugin.Everything</RootNamespace>
|
||||
@ -14,9 +14,6 @@
|
||||
<Platforms>x64</Platforms>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Authors>Yu Chieh (Victor) Lin</Authors>
|
||||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
|
||||
<ApplicationIcon />
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@ -37,15 +34,13 @@
|
||||
<OutputPath>..\..\..\..\..\x64\Release\modules\launcher\Plugins\Everything\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>none</DebugType>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -60,11 +55,9 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@ -75,7 +68,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@ -109,6 +102,9 @@
|
||||
<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>
|
||||
</None>
|
||||
@ -121,7 +117,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"
rmdir /S /Q "$(TargetDir)\ref"" />
|
||||
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
11
Main.cs
11
Main.cs
@ -26,7 +26,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
{
|
||||
private const string Wait = nameof(Wait);
|
||||
private const string Top = nameof(Top);
|
||||
private const string Preview = nameof(Preview);
|
||||
private const string NoPreview = nameof(NoPreview);
|
||||
private readonly string reservedStringPattern = @"^[\/\\\$\%]+$|^.*[<>].*$";
|
||||
private bool _wait;
|
||||
private bool _top;
|
||||
@ -52,7 +52,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
},
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = Preview,
|
||||
Key = NoPreview,
|
||||
DisplayLabel = Resources.Preview,
|
||||
Value = false,
|
||||
},
|
||||
@ -104,7 +104,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
source?.Cancel();
|
||||
source = new CancellationTokenSource();
|
||||
CancellationToken token = source.Token;
|
||||
source.CancelAfter(_wait ? 1000 : 120);
|
||||
source.CancelAfter(_wait ? 1000 : 150);
|
||||
try
|
||||
{
|
||||
results.AddRange(EverythingSearch(searchQuery, _top, _preview, token));
|
||||
@ -132,7 +132,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
source.Dispose();
|
||||
source.Cancel();
|
||||
Log.Exception("Everything Exception", e, GetType());
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
{
|
||||
wait = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Wait)?.Value ?? false;
|
||||
top = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Top)?.Value ?? false;
|
||||
nopreview = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Preview)?.Value ?? false;
|
||||
nopreview = settings.AdditionalOptions.FirstOrDefault(x => x.Key == NoPreview)?.Value ?? false;
|
||||
}
|
||||
|
||||
_top = top;
|
||||
@ -191,7 +191,6 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
source.Dispose();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
|
@ -10,7 +10,6 @@ using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@ -23,6 +22,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[Flags]
|
||||
internal enum Request
|
||||
{
|
||||
FILE_NAME = 0x00000001,
|
||||
@ -73,6 +73,18 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
DATE_RUN_DESCENDING,
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct SHFILEINFO
|
||||
{
|
||||
internal IntPtr hIcon;
|
||||
internal int iIcon;
|
||||
internal int dwAttributes;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
||||
internal string szDisplayName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
|
||||
internal string szTypeName;
|
||||
}
|
||||
|
||||
internal const string dllName = "Everything64.dll"; // Included dll is a modified file without locking, if this creates issues, replace with official dll
|
||||
|
||||
#pragma warning disable SA1516 // Elements should be separated by blank line
|
||||
@ -131,7 +143,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
Title = name,
|
||||
ToolTipData = new ToolTipData("Name : " + name, "Path : " + path),
|
||||
SubTitle = Resources.plugin_name + ": " + fullPath,
|
||||
IcoPath = (preview || string.IsNullOrEmpty(ext) || string.IsNullOrEmpty((string)Icons[ext])) ? fullPath : (string)Icons[ext],
|
||||
IcoPath = (preview || string.IsNullOrEmpty(ext)) ? fullPath : (string)Icons[ext],
|
||||
ContextData = new SearchResult()
|
||||
{
|
||||
Path = fullPath,
|
||||
@ -158,7 +170,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
},
|
||||
QueryTextDisplay = isFolder ? path : name,
|
||||
};
|
||||
if (top) r.Score = (int)(300 - i);
|
||||
if (top) r.Score = (int)(max - i);
|
||||
yield return r;
|
||||
}
|
||||
|
||||
@ -174,9 +186,6 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
}
|
||||
}
|
||||
|
||||
// Credits https://www.codeproject.com/Articles/29137/Get-Registered-File-Types-and-Their-Associated-Ico
|
||||
[DllImport("shell32.dll", EntryPoint = "ExtractIconA", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
|
||||
private static extern IntPtr ExtractIcon(int hInst, string lpszExeFileName, int nIconIndex);
|
||||
internal static readonly Hashtable Icons = GetFileTypeAndIcon();
|
||||
internal static Hashtable GetFileTypeAndIcon()
|
||||
{
|
||||
@ -198,14 +207,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
object defaultValue = rkFileType.GetValue(string.Empty);
|
||||
if (defaultValue == null)
|
||||
continue;
|
||||
string defaultIcon = defaultValue.ToString() + "\\DefaultIcon";
|
||||
RegistryKey rkFileIcon = rkRoot.OpenSubKey(defaultIcon);
|
||||
string prog = defaultValue.ToString() + "\\shell\\Open\\command";
|
||||
RegistryKey rkFileIcon = rkRoot.OpenSubKey(prog);
|
||||
if (rkFileIcon != null)
|
||||
{
|
||||
object value = rkFileIcon.GetValue(string.Empty);
|
||||
if (value != null)
|
||||
{
|
||||
string fileParam = value.ToString().Replace("\"", string.Empty, StringComparison.CurrentCulture).Split(',')[0].Trim();
|
||||
string fileParam = value.ToString().Split("\" ")[0].Replace("\"", string.Empty, StringComparison.CurrentCulture).Trim();
|
||||
iconsInfo.Add(keyName, fileParam);
|
||||
}
|
||||
|
||||
|
6
Properties/Resources.Designer.cs
generated
6
Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
@ -151,7 +151,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Preview - Preview file content as icon, may cause freezing if file not local..
|
||||
/// Looks up a localized string similar to Preview - Preview file content as icon, may cause freezing if file is not local..
|
||||
/// </summary>
|
||||
public static string Preview {
|
||||
get {
|
||||
@ -178,7 +178,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 Top - Insert result at the top of the list, may cause pre-selectino issue..
|
||||
/// </summary>
|
||||
public static string Top {
|
||||
get {
|
||||
|
@ -148,7 +148,7 @@
|
||||
<value>Everything</value>
|
||||
</data>
|
||||
<data name="Preview" xml:space="preserve">
|
||||
<value>Preview - Preview file content as icon, may cause freezing if file not local.</value>
|
||||
<value>Preview - Preview file content as icon, may cause freezing if file is not local.</value>
|
||||
</data>
|
||||
<data name="run_as_admin" xml:space="preserve">
|
||||
<value>Run as administrator (Ctrl+Shift+Enter)</value>
|
||||
@ -157,7 +157,7 @@
|
||||
<value>Timed out before finishing the query</value>
|
||||
</data>
|
||||
<data name="Top" xml:space="preserve">
|
||||
<value>Top - Insert result at the top of the list, may cause pre-selection issue.</value>
|
||||
<value>Top - Insert result at the top of the list, may cause pre-selectino issue.</value>
|
||||
</data>
|
||||
<data name="Wait" xml:space="preserve">
|
||||
<value>Wait - Wait longer for the query to finish, enable only if prompted to.</value>
|
||||
|
@ -2,7 +2,7 @@
|
||||
---
|
||||
This repo is to be used as a submodule for [PowerToys repo](https://github.com/lin-ycv/PowerToys/tree/Everything), this will not compile when used standalone, as it's missing references from PowerToys.
|
||||
|
||||
The release is the compiled reult of this repo, extract the downloaded folder to `C:\Program Files\PowerToys\modules\launcher\Plugins`
|
||||
The release is the compiled result of this repo, extract the downloaded folder to `C:\Program Files\PowerToys\modules\launcher\Plugins`
|
||||
|
||||
[Everything](https://www.voidtools.com/downloads/) has to be downloaded seperately, and be running in order for this pluging to work.<br>
|
||||
**\*This does not work with the lite version of Everything, it does not support IPC**<br>
|
||||
|
@ -4,7 +4,7 @@
|
||||
"IsGlobal": true,
|
||||
"Name": "Everything",
|
||||
"Author": "Yu Chieh (Victor) Lin",
|
||||
"Version": "0.55.1.0",
|
||||
"Version": "0.56.2.0",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/lin-ycv/EverythingPowerToys",
|
||||
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",
|
||||
|
Loading…
Reference in New Issue
Block a user