mirror of
https://github.com/lin-ycv/EverythingPowerToys.git
synced 2025-01-08 11:57:59 +08:00
Updated to .NET 5 for v0.55.0
- Modified icon preview for better stabiliy, esp when file is not local - Better setting descriptions - Changed versioning to match PT version built against
This commit is contained in:
parent
ef2c587af8
commit
d34939c16e
@ -1,23 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<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>0.0.2.5</Version>
|
||||
<Version>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)plugin.json').Split(',')[5].Split(':')[1].Trim().Trim('"'))</Version>
|
||||
<useWPF>true</useWPF>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<Platforms>x64</Platforms>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Authors>Yu Chieh (Victor) Lin</Authors>
|
||||
<Company />
|
||||
<Product />
|
||||
<AssemblyVersion>0.0.2.5</AssemblyVersion>
|
||||
<FileVersion>0.0.2.5</FileVersion>
|
||||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
|
||||
<ApplicationIcon />
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@ -38,13 +37,15 @@
|
||||
<OutputPath>..\..\..\..\..\x64\Release\modules\launcher\Plugins\Everything\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugType>none</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>
|
||||
@ -59,9 +60,11 @@
|
||||
<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>
|
||||
|
||||
@ -106,9 +109,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>
|
||||
</None>
|
||||
@ -121,7 +121,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"" />
|
||||
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"
rmdir /S /Q "$(TargetDir)\ref"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
16
Main.cs
16
Main.cs
@ -26,11 +26,11 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
{
|
||||
private const string Wait = nameof(Wait);
|
||||
private const string Top = nameof(Top);
|
||||
private const string NoPreview = nameof(NoPreview);
|
||||
private const string Preview = nameof(Preview);
|
||||
private readonly string reservedStringPattern = @"^[\/\\\$\%]+$|^.*[<>].*$";
|
||||
private bool _wait;
|
||||
private bool _top;
|
||||
private bool _noPreview;
|
||||
private bool _preview;
|
||||
|
||||
public string Name => Resources.plugin_name;
|
||||
|
||||
@ -52,8 +52,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
},
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = NoPreview,
|
||||
DisplayLabel = Resources.NoPreview,
|
||||
Key = Preview,
|
||||
DisplayLabel = Resources.Preview,
|
||||
Value = false,
|
||||
},
|
||||
};
|
||||
@ -104,10 +104,10 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
source?.Cancel();
|
||||
source = new CancellationTokenSource();
|
||||
CancellationToken token = source.Token;
|
||||
source.CancelAfter(_wait ? 1000 : 75);
|
||||
source.CancelAfter(_wait ? 1000 : 120);
|
||||
try
|
||||
{
|
||||
results.AddRange(EverythingSearch(searchQuery, _top, _noPreview, token));
|
||||
results.AddRange(EverythingSearch(searchQuery, _top, _preview, token));
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@ -177,12 +177,12 @@ 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 == NoPreview)?.Value ?? false;
|
||||
nopreview = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Preview)?.Value ?? false;
|
||||
}
|
||||
|
||||
_top = top;
|
||||
_wait = wait;
|
||||
_noPreview = nopreview;
|
||||
_preview = nopreview;
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
@ -3,17 +3,20 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
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;
|
||||
using System.Threading.Tasks;
|
||||
using Community.PowerToys.Run.Plugin.Everything.Properties;
|
||||
using Microsoft.Win32;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.Everything
|
||||
@ -97,7 +100,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
Everything_SetMax(max);
|
||||
}
|
||||
|
||||
public static IEnumerable<Result> EverythingSearch(string qry, bool top, bool noPreview, CancellationToken token)
|
||||
public static IEnumerable<Result> EverythingSearch(string qry, bool top, bool preview, CancellationToken token)
|
||||
{
|
||||
_ = Everything_SetSearchW(qry);
|
||||
if (token.IsCancellationRequested) token.ThrowIfCancellationRequested();
|
||||
@ -121,13 +124,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
path = fullPath;
|
||||
else
|
||||
path = Path.GetDirectoryName(fullPath);
|
||||
string ext = Path.GetExtension(fullPath);
|
||||
|
||||
var r = new Result()
|
||||
{
|
||||
Title = name,
|
||||
ToolTipData = new ToolTipData("Name : " + name, "Path : " + path),
|
||||
SubTitle = Resources.plugin_name + ": " + fullPath,
|
||||
IcoPath = noPreview ? "Images/Everything.ico.png" : fullPath,
|
||||
IcoPath = (preview || string.IsNullOrEmpty(ext) || string.IsNullOrEmpty((string)Icons[ext])) ? fullPath : (string)Icons[ext],
|
||||
ContextData = new SearchResult()
|
||||
{
|
||||
Path = fullPath,
|
||||
@ -154,7 +158,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
},
|
||||
QueryTextDisplay = isFolder ? path : name,
|
||||
};
|
||||
if (top) r.Score = (int)(max - i);
|
||||
if (top) r.Score = (int)(300 - i);
|
||||
yield return r;
|
||||
}
|
||||
|
||||
@ -169,6 +173,56 @@ 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()
|
||||
{
|
||||
try
|
||||
{
|
||||
RegistryKey rkRoot = Registry.ClassesRoot;
|
||||
string[] keyNames = rkRoot.GetSubKeyNames();
|
||||
Hashtable iconsInfo = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
|
||||
foreach (string keyName in keyNames)
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyName))
|
||||
continue;
|
||||
int indexOfPoint = keyName.IndexOf(".", StringComparison.CurrentCulture);
|
||||
if (indexOfPoint != 0)
|
||||
continue;
|
||||
RegistryKey rkFileType = rkRoot.OpenSubKey(keyName);
|
||||
if (rkFileType == null)
|
||||
continue;
|
||||
object defaultValue = rkFileType.GetValue(string.Empty);
|
||||
if (defaultValue == null)
|
||||
continue;
|
||||
string defaultIcon = defaultValue.ToString() + "\\DefaultIcon";
|
||||
RegistryKey rkFileIcon = rkRoot.OpenSubKey(defaultIcon);
|
||||
if (rkFileIcon != null)
|
||||
{
|
||||
object value = rkFileIcon.GetValue(string.Empty);
|
||||
if (value != null)
|
||||
{
|
||||
string fileParam = value.ToString().Replace("\"", string.Empty, StringComparison.CurrentCulture).Split(',')[0].Trim();
|
||||
iconsInfo.Add(keyName, fileParam);
|
||||
}
|
||||
|
||||
rkFileIcon.Close();
|
||||
}
|
||||
|
||||
rkFileType.Close();
|
||||
}
|
||||
|
||||
rkRoot.Close();
|
||||
return iconsInfo;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#pragma warning restore SA1503 // Braces should not be omitted
|
||||
}
|
||||
}
|
||||
|
22
Properties/Resources.Designer.cs
generated
22
Properties/Resources.Designer.cs
generated
@ -114,15 +114,6 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Fast - Disable icon preview, fetching icons for non-local files may cause freezing..
|
||||
/// </summary>
|
||||
public static string NoPreview {
|
||||
get {
|
||||
return ResourceManager.GetString("NoPreview", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Open containing folder (Ctrl+Shift+E).
|
||||
/// </summary>
|
||||
@ -159,6 +150,15 @@ 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..
|
||||
/// </summary>
|
||||
public static string Preview {
|
||||
get {
|
||||
return ResourceManager.GetString("Preview", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Run as administrator (Ctrl+Shift+Enter).
|
||||
/// </summary>
|
||||
@ -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..
|
||||
/// Looks up a localized string similar to Top - Insert result at the top of the list, may cause pre-selection issue..
|
||||
/// </summary>
|
||||
public static string Top {
|
||||
get {
|
||||
@ -187,7 +187,7 @@ namespace Community.PowerToys.Run.Plugin.Everything.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Wait - Wait longer for the query to finish..
|
||||
/// Looks up a localized string similar to Wait - Wait longer for the query to finish, enable only if prompted to..
|
||||
/// </summary>
|
||||
public static string Wait {
|
||||
get {
|
||||
|
@ -135,9 +135,6 @@
|
||||
<data name="folder_open_failed" xml:space="preserve">
|
||||
<value>Fail to open folder at</value>
|
||||
</data>
|
||||
<data name="NoPreview" xml:space="preserve">
|
||||
<value>Fast - Disable icon preview, fetching icons for non-local files may cause freezing.</value>
|
||||
</data>
|
||||
<data name="open_containing_folder" xml:space="preserve">
|
||||
<value>Open containing folder (Ctrl+Shift+E)</value>
|
||||
</data>
|
||||
@ -150,6 +147,9 @@
|
||||
<data name="plugin_name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name="run_as_admin" xml:space="preserve">
|
||||
<value>Run as administrator (Ctrl+Shift+Enter)</value>
|
||||
</data>
|
||||
@ -157,9 +157,9 @@
|
||||
<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.</value>
|
||||
<value>Top - Insert result at the top of the list, may cause pre-selection issue.</value>
|
||||
</data>
|
||||
<data name="Wait" xml:space="preserve">
|
||||
<value>Wait - Wait longer for the query to finish.</value>
|
||||
<value>Wait - Wait longer for the query to finish, enable only if prompted to.</value>
|
||||
</data>
|
||||
</root>
|
@ -4,7 +4,7 @@
|
||||
"IsGlobal": true,
|
||||
"Name": "Everything",
|
||||
"Author": "Yu Chieh (Victor) Lin",
|
||||
"Version": "0.2.5",
|
||||
"Version": "0.55.1.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