mirror of
https://github.com/lin-ycv/EverythingPowerToys.git
synced 2025-01-07 03:16:41 +08:00
LibraryImport
code cleanup
This commit is contained in:
parent
768fed0366
commit
534b91c064
3
.github/README.md
vendored
3
.github/README.md
vendored
@ -16,8 +16,7 @@ Dev instructions are in the wiki.
|
|||||||
There are 4 different methods of installation, chose the one you prefer:
|
There are 4 different methods of installation, chose the one you prefer:
|
||||||
1) WinGet : `winget install lin-ycv.EverythingPowerToys`
|
1) WinGet : `winget install lin-ycv.EverythingPowerToys`
|
||||||
2) Chocolatey : `choco install everythingpowertoys`
|
2) Chocolatey : `choco install everythingpowertoys`
|
||||||
3) ~Scoop : `scoop install everythingpowertoys`~
|
3) Self-Extraction Installer (EXE) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
||||||
4) Self-Extraction Installer (EXE) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
|
||||||
5) Manual Installation (ZIP) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
5) Manual Installation (ZIP) : [Download from release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
||||||
|
|
||||||
Detailed explanations and instructions are on the [release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
Detailed explanations and instructions are on the [release page](https://github.com/lin-ycv/EverythingPowerToys/releases/latest)
|
||||||
|
@ -2,59 +2,34 @@
|
|||||||
<Import Project="..\..\..\..\Version.props" />
|
<Import Project="..\..\..\..\Version.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ProjectGuid>{64467D32-4786-4ADD-9B77-FBF3C965D3D1}</ProjectGuid>
|
<ProjectGuid>{64467D32-4786-4ADD-9B77-FBF3C965D3D1}</ProjectGuid>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Community.PowerToys.Run.Plugin.Everything</RootNamespace>
|
<RootNamespace>Community.PowerToys.Run.Plugin.Everything</RootNamespace>
|
||||||
<AssemblyName>Community.PowerToys.Run.Plugin.Everything</AssemblyName>
|
<AssemblyName>Community.PowerToys.Run.Plugin.Everything</AssemblyName>
|
||||||
<Version>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)plugin.json').Split(',')[5].Split(':')[1].Trim().Trim('"'))</Version>
|
<Version>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)plugin.json').Split(',')[5].Split(':')[1].Trim().Trim('"'))</Version>
|
||||||
<useWPF>true</useWPF>
|
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<Authors>Yu Chieh (Victor) Lin</Authors>
|
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
|
||||||
<PackageProjectUrl>https://github.com/lin-ycv/EverythingPowerToys</PackageProjectUrl>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
<PackageIcon>Everything.light.png</PackageIcon>
|
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<Company>lin-ycv</Company>
|
<Company>lin-ycv</Company>
|
||||||
<Copyright>Copyright (C) lin-ycv</Copyright>
|
<Copyright>Copyright (C) lin-ycv</Copyright>
|
||||||
<RepositoryUrl>https://github.com/lin-ycv/EverythingPowerToys</RepositoryUrl>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<PackageTags>PowerToys;Everything;EverythingPowerToys;</PackageTags>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<OutputPath>..\..\..\..\..\$(Platform)\$(Configuration)\RunPlugins\Everything\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||||
<OutputPath>..\..\..\..\..\$(Platform)\$(Configuration)\RunPlugins\Everything\</OutputPath>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="NativeMethods.cs" />
|
<Compile Remove="NativeMethods.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -149,8 +124,22 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods">
|
||||||
|
<Static>True</Static>
|
||||||
|
</Using>
|
||||||
|
<Using Include="Community.PowerToys.Run.Plugin.Everything.Properties" />
|
||||||
|
<Using Include="System.Diagnostics" />
|
||||||
|
<Using Include="System.Reflection" />
|
||||||
|
<Using Include="System.Text" />
|
||||||
|
<Using Include="System.Windows" />
|
||||||
|
<Using Include="System.Windows.Controls" />
|
||||||
|
<Using Include="Wox.Plugin" />
|
||||||
|
<Using Include="Wox.Plugin.Logger" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"
del /Q "$(TargetDir)Wox*.dll"
del /Q "$(TargetDir)Ijwhost.dll"
del /Q "$(TargetDir)*.xml"
del/ Q "$(TargetDir)backup_restore_settings.json"
del /Q ".\bin\CHECKSUM.txt"
powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-x64.zip -Force
"C:\Program Files (x86)\NSIS\makensis" /Dver=$(Version) .\NSIS\exeCreator.nsi
certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.zip SHA256 >> .\bin\CHECKSUM.txt
certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.exe SHA256 >> .\bin\CHECKSUM.txt
rd /Q /S "$(TargetDir)"" />
|
<Exec Command="del /Q "$(TargetDir)*.pdb"
del /Q "$(TargetDir)PowerToys*.dll"
del /Q "$(TargetDir)Wox*.dll"
del /Q "$(TargetDir)Ijwhost.dll"
del /Q "$(TargetDir)*.xml"
del/ Q "$(TargetDir)backup_restore_settings.json"
del /Q ".\bin\CHECKSUM.txt"
powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-x64.zip -Force
"C:\Program Files (x86)\NSIS\makensis" /Dver=$(Version) /Ddirect=$(TargetDir) .\NSIS\exeCreator.nsi
certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.zip SHA256 >> .\bin\CHECKSUM.txt
certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.exe SHA256 >> .\bin\CHECKSUM.txt" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Plugin;
|
|
||||||
using Wox.Plugin.Logger;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything
|
namespace Community.PowerToys.Run.Plugin.Everything
|
||||||
{
|
{
|
||||||
@ -43,7 +35,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.open_containing_folder,
|
Title = Resources.open_containing_folder,
|
||||||
Glyph = "\xE838",
|
Glyph = "\xE838",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.E,
|
AcceleratorKey = Key.E,
|
||||||
@ -52,7 +44,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
{
|
{
|
||||||
if (!Helper.OpenInShell("explorer.exe", $"/select,\"{record.Path}\""))
|
if (!Helper.OpenInShell("explorer.exe", $"/select,\"{record.Path}\""))
|
||||||
{
|
{
|
||||||
var message = $"{Properties.Resources.folder_open_failed} {Path.GetDirectoryName(record.Path)}";
|
var message = $"{Resources.folder_open_failed} {Path.GetDirectoryName(record.Path)}";
|
||||||
_context.API.ShowMsg(message);
|
_context.API.ShowMsg(message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -70,7 +62,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.run_as_admin,
|
Title = Resources.run_as_admin,
|
||||||
Glyph = "\xE7EF",
|
Glyph = "\xE7EF",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.Enter,
|
AcceleratorKey = Key.Enter,
|
||||||
@ -99,7 +91,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.run_as_user,
|
Title = Resources.run_as_user,
|
||||||
Glyph = "\xE7EE",
|
Glyph = "\xE7EE",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.U,
|
AcceleratorKey = Key.U,
|
||||||
@ -126,7 +118,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.copy_file + (_swapCopy ? Properties.Resources.copy_shortcut : Properties.Resources.copy_shortcutAlt),
|
Title = Resources.copy_file + (_swapCopy ? Resources.copy_shortcut : Resources.copy_shortcutAlt),
|
||||||
Glyph = "\xE8C8",
|
Glyph = "\xE8C8",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.C,
|
AcceleratorKey = Key.C,
|
||||||
@ -141,7 +133,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var message = Properties.Resources.clipboard_failed;
|
var message = Resources.clipboard_failed;
|
||||||
Log.Exception(message, e, GetType());
|
Log.Exception(message, e, GetType());
|
||||||
|
|
||||||
_context.API.ShowMsg(message);
|
_context.API.ShowMsg(message);
|
||||||
@ -155,7 +147,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.copy_path + (_swapCopy ? Properties.Resources.copy_shortcutAlt : Properties.Resources.copy_shortcut),
|
Title = Resources.copy_path + (_swapCopy ? Resources.copy_shortcutAlt : Resources.copy_shortcut),
|
||||||
Glyph = "\xE71B",
|
Glyph = "\xE71B",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.C,
|
AcceleratorKey = Key.C,
|
||||||
@ -170,7 +162,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var message = Properties.Resources.clipboard_failed;
|
var message = Resources.clipboard_failed;
|
||||||
Log.Exception(message, e, GetType());
|
Log.Exception(message, e, GetType());
|
||||||
|
|
||||||
_context.API.ShowMsg(message);
|
_context.API.ShowMsg(message);
|
||||||
@ -184,7 +176,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
contextMenus.Add(new ContextMenuResult
|
contextMenus.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
Title = Properties.Resources.open_in_console,
|
Title = Resources.open_in_console,
|
||||||
Glyph = "\xE756",
|
Glyph = "\xE756",
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
AcceleratorKey = Key.C,
|
AcceleratorKey = Key.C,
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using Community.PowerToys.Run.Plugin.Everything.Properties;
|
|
||||||
using Wox.Plugin;
|
|
||||||
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything
|
namespace Community.PowerToys.Run.Plugin.Everything
|
||||||
{
|
{
|
||||||
@ -14,8 +6,8 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
{
|
{
|
||||||
internal Everything(Settings setting)
|
internal Everything(Settings setting)
|
||||||
{
|
{
|
||||||
Everything_SetRequestFlags(Request.FULL_PATH_AND_FILE_NAME);
|
Everything_SetRequestFlags(Request.FULL_PATH_AND_FILE_NAME);
|
||||||
UpdateSettings(setting);
|
UpdateSettings(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdateSettings(Settings setting)
|
internal void UpdateSettings(Settings setting)
|
||||||
@ -57,7 +49,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = Everything_SetSearchW(query);
|
Everything_SetSearchW(query);
|
||||||
if (!Everything_QueryW(true))
|
if (!Everything_QueryW(true))
|
||||||
{
|
{
|
||||||
throw new Win32Exception("Unable to Query");
|
throw new Win32Exception("Unable to Query");
|
||||||
@ -72,9 +64,9 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
|
|
||||||
for (uint i = 0; i < resultCount; i++)
|
for (uint i = 0; i < resultCount; i++)
|
||||||
{
|
{
|
||||||
StringBuilder buffer = new(260);
|
char[] buffer = new char[260];
|
||||||
Everything_GetResultFullPathName(i, buffer, 260);
|
uint length = Everything_GetResultFullPathName(i, buffer, (uint)buffer.Length);
|
||||||
string fullPath = buffer.ToString();
|
string fullPath = new(buffer, 0, (int)length);
|
||||||
string name = Path.GetFileName(fullPath);
|
string name = Path.GetFileName(fullPath);
|
||||||
bool isFolder = Everything_IsFolderResult(i);
|
bool isFolder = Everything_IsFolderResult(i);
|
||||||
string path = isFolder ? fullPath : Path.GetDirectoryName(fullPath);
|
string path = isFolder ? fullPath : Path.GetDirectoryName(fullPath);
|
||||||
@ -87,7 +79,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
SubTitle = Resources.plugin_name + ": " + fullPath,
|
SubTitle = Resources.plugin_name + ": " + fullPath,
|
||||||
|
|
||||||
IcoPath = isFolder ? "Images/folder.png" : (setting.Preview ?
|
IcoPath = isFolder ? "Images/folder.png" : (setting.Preview ?
|
||||||
fullPath : (SearchHelper.IconLoader.Icon(ext) ?? "Images/file.png")),
|
fullPath : "Images/file.png"),
|
||||||
ContextData = new SearchResult()
|
ContextData = new SearchResult()
|
||||||
{
|
{
|
||||||
Path = fullPath,
|
Path = fullPath,
|
||||||
|
BIN
EverythingARM64.dll
Normal file
BIN
EverythingARM64.dll
Normal file
Binary file not shown.
@ -12,5 +12,4 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Reviewed")]
|
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Reviewed")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "Reviewed")]
|
[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.DocumentationRules", "SA1636:FileHeaderCopyrightTextMustMatch", Justification = "Reviewed.")]
|
||||||
[assembly: SuppressMessage("Performance", "CA1838:Avoid 'StringBuilder' parameters for P/Invokes", Justification = "breaks icon preview for some reason when using char[]")]
|
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "Reviewed")]
|
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "Reviewed")]
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything.Interop
|
namespace Community.PowerToys.Run.Plugin.Everything.Interop
|
||||||
{
|
{
|
||||||
public sealed class NativeMethods
|
public sealed partial class NativeMethods
|
||||||
{
|
{
|
||||||
#region FlagsEnums
|
#region FlagsEnums
|
||||||
[Flags]
|
[Flags]
|
||||||
@ -106,32 +104,33 @@ namespace Community.PowerToys.Run.Plugin.Everything.Interop
|
|||||||
MAX,
|
MAX,
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal const string dllName = "Everything64.dll";
|
internal const string dllName = "Everything64.dll";
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern uint Everything_GetNumResults();
|
internal static partial uint Everything_GetLastError();
|
||||||
[DllImport(dllName, CharSet = CharSet.Unicode)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern void Everything_GetResultFullPathName(uint nIndex, StringBuilder lpString, uint nMaxCount);
|
internal static partial uint Everything_GetNumResults();
|
||||||
[DllImport(dllName, CharSet = CharSet.Unicode)]
|
[LibraryImport(dllName, EntryPoint = "Everything_GetResultFullPathNameW", StringMarshalling = StringMarshalling.Utf16)]
|
||||||
internal static extern uint Everything_IncRunCountFromFileName(string lpFileName);
|
internal static partial uint Everything_GetResultFullPathName(uint nIndex, [Out] char[] lpString, uint nMaxCount);
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName, StringMarshalling = StringMarshalling.Utf16)]
|
||||||
internal static extern bool Everything_IsFolderResult(uint index);
|
internal static partial uint Everything_IncRunCountFromFileName(string lpFileName);
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern bool Everything_QueryW(bool bWait);
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
[DllImport(dllName)]
|
internal static partial bool Everything_IsFolderResult(uint index);
|
||||||
internal static extern void Everything_SetMax(uint dwMax);
|
[LibraryImport(dllName)]
|
||||||
[DllImport(dllName)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
internal static extern void Everything_SetRegex(bool bEnable);
|
internal static partial bool Everything_QueryW([MarshalAs(UnmanagedType.Bool)] bool bWait);
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern void Everything_SetRequestFlags(Request RequestFlags);
|
internal static partial void Everything_SetMax(uint dwMax);
|
||||||
[DllImport(dllName, CharSet = CharSet.Unicode)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern uint Everything_SetSearchW(string lpSearchString);
|
internal static partial void Everything_SetRegex([MarshalAs(UnmanagedType.Bool)] bool bEnable);
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName)]
|
||||||
internal static extern bool Everything_SetMatchPath(bool bEnable);
|
internal static partial void Everything_SetRequestFlags(Request RequestFlags);
|
||||||
[DllImport(dllName)]
|
[LibraryImport(dllName, StringMarshalling = StringMarshalling.Utf16)]
|
||||||
internal static extern void Everything_SetSort(Sort SortType);
|
internal static partial void Everything_SetSearchW(string lpSearchString);
|
||||||
|
[LibraryImport(dllName)]
|
||||||
[DllImport("Shlwapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
internal static extern uint AssocQueryString(AssocF flags, AssocStr str, string pszAssoc, string pszExtra, [Out] char[] pszOut, [In][Out] ref uint pcchOut);
|
internal static partial bool Everything_SetMatchPath([MarshalAs(UnmanagedType.Bool)] bool bEnable);
|
||||||
|
[LibraryImport(dllName)]
|
||||||
|
internal static partial void Everything_SetSort(Sort SortType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
Main.cs
12
Main.cs
@ -1,14 +1,4 @@
|
|||||||
using System;
|
using Microsoft.PowerToys.Settings.UI.Library;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Community.PowerToys.Run.Plugin.Everything.Properties;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Library;
|
|
||||||
using Wox.Plugin;
|
|
||||||
using Wox.Plugin.Logger;
|
|
||||||
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything
|
namespace Community.PowerToys.Run.Plugin.Everything
|
||||||
{
|
{
|
||||||
|
@ -36,28 +36,27 @@ Page instfiles
|
|||||||
|
|
||||||
Section ""
|
Section ""
|
||||||
|
|
||||||
; Don't terminate processes, helps reduce AV FP
|
|
||||||
;ExecWait '"$%SystemRoot%\system32\TaskKill.exe" /F /IM ${PT}'
|
;ExecWait '"$%SystemRoot%\system32\TaskKill.exe" /F /IM ${PT}'
|
||||||
;ExecWait 'wmic process where name="${PT}" call terminate'
|
|
||||||
;Sleep 3000
|
|
||||||
|
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
GetFullPathName $0 "$EXEDIR\"
|
GetFullPathName $0 "$EXEDIR\"
|
||||||
GetFullPathName $0 $0
|
GetFullPathName $0 $0
|
||||||
File /r ".\..\..\..\..\..\..\x64\Release\RunPlugins\Everything\*"
|
File /r "${direct}\*"
|
||||||
|
|
||||||
; Also don't launch processes, helps reduce AV FP
|
IfFileExists "$LOCALAPPDATA\PowerToys\${PT}" 0 +2
|
||||||
;IfFileExists "$LOCALAPPDATA\PowerToys\${PT}" 0 +2
|
Exec '"$LOCALAPPDATA\PowerToys\${PT}"'
|
||||||
;Exec '"$LOCALAPPDATA\PowerToys\${PT}"'
|
|
||||||
|
|
||||||
;IfFileExists "$PROGRAMFILES64\PowerToys\${PT}" 0 +2
|
IfFileExists "$PROGRAMFILES64\PowerToys\${PT}" 0 +2
|
||||||
;Exec '"$PROGRAMFILES64\PowerToys\${PT}"'
|
Exec '"$PROGRAMFILES64\PowerToys\${PT}"'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
; Don't query proceses, helps reduce AV FP
|
Function .onInit
|
||||||
;Function .onInit
|
|
||||||
|
ExecWait 'wmic process where name="${PT}" call terminate'
|
||||||
|
ExecWait 'wmic process where name="PowerToys.PowerLauncher.exe" call terminate'
|
||||||
|
Sleep 200
|
||||||
|
|
||||||
; System::Call 'kernel32::CreateMutex(p 0, i 0, t "ACFEF7F6-7856-4BB3-82E3-0877CBB4E9C7") p .r1 ?e'
|
; System::Call 'kernel32::CreateMutex(p 0, i 0, t "ACFEF7F6-7856-4BB3-82E3-0877CBB4E9C7") p .r1 ?e'
|
||||||
; Pop $R0
|
; Pop $R0
|
||||||
@ -66,4 +65,4 @@ SectionEnd
|
|||||||
; MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
|
; MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
|
||||||
; Abort
|
; Abort
|
||||||
|
|
||||||
; FunctionEnd
|
FunctionEnd
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using static Community.PowerToys.Run.Plugin.Everything.Interop.NativeMethods;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything.SearchHelper
|
|
||||||
{
|
|
||||||
internal sealed class IconLoader
|
|
||||||
{
|
|
||||||
internal static readonly char[] Separator = ['\"', ','];
|
|
||||||
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
|
|
||||||
internal static string? Icon(string doctype)
|
|
||||||
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
|
|
||||||
{
|
|
||||||
uint pcchOut = 0;
|
|
||||||
_ = AssocQueryString(AssocF.NONE, AssocStr.DEFAULTICON, doctype, null, null, ref pcchOut);
|
|
||||||
char[] pszOut = new char[pcchOut];
|
|
||||||
if (AssocQueryString(AssocF.NONE, AssocStr.DEFAULTICON, doctype, null, pszOut, ref pcchOut) != 0) return null;
|
|
||||||
string doc = Environment.ExpandEnvironmentVariables(new string(pszOut).Split(Separator, StringSplitOptions.RemoveEmptyEntries)[0].Replace("\"", string.Empty, StringComparison.CurrentCulture).Trim());
|
|
||||||
|
|
||||||
return File.Exists(doc) ? doc : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Community.PowerToys.Run.Plugin.Everything
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything
|
|
||||||
{
|
{
|
||||||
public class Settings
|
public class Settings
|
||||||
{
|
{
|
||||||
|
12
Update.cs
12
Update.cs
@ -1,17 +1,11 @@
|
|||||||
using System;
|
using System.Globalization;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using Community.PowerToys.Run.Plugin.Everything.Properties;
|
|
||||||
|
|
||||||
namespace Community.PowerToys.Run.Plugin.Everything
|
namespace Community.PowerToys.Run.Plugin.Everything
|
||||||
{
|
{
|
||||||
internal sealed class Update
|
internal sealed class Update
|
||||||
{
|
{
|
||||||
|
private readonly CompositeFormat updateAvailable = CompositeFormat.Parse(Resources.UpdateAvailable);
|
||||||
internal async Task UpdateAsync(Version v, Settings s)
|
internal async Task UpdateAsync(Version v, Settings s)
|
||||||
{
|
{
|
||||||
string apiUrl = "https://api.github.com/repos/lin-ycv/EverythingPowerToys/releases/latest";
|
string apiUrl = "https://api.github.com/repos/lin-ycv/EverythingPowerToys/releases/latest";
|
||||||
@ -30,7 +24,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
|||||||
: Version.Parse(root.GetProperty("tag_name").GetString());
|
: Version.Parse(root.GetProperty("tag_name").GetString());
|
||||||
if (latest > v && latest.ToString() != s.Skip)
|
if (latest > v && latest.ToString() != s.Skip)
|
||||||
{
|
{
|
||||||
MessageBoxResult mbox = MessageBox.Show(string.Format(CultureInfo.InvariantCulture, Resources.UpdateAvailable, v, latest), "Updater", MessageBoxButton.YesNoCancel);
|
MessageBoxResult mbox = MessageBox.Show(string.Format(CultureInfo.InvariantCulture, updateAvailable, v, latest), "Updater", MessageBoxButton.YesNoCancel);
|
||||||
if (mbox == MessageBoxResult.Yes && root.TryGetProperty("assets", out JsonElement assets))
|
if (mbox == MessageBoxResult.Yes && root.TryGetProperty("assets", out JsonElement assets))
|
||||||
{
|
{
|
||||||
string[] nameUrl = [string.Empty, string.Empty];
|
string[] nameUrl = [string.Empty, string.Empty];
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"IsGlobal": true,
|
"IsGlobal": true,
|
||||||
"Name": "Everything",
|
"Name": "Everything",
|
||||||
"Author": "Yu Chieh (Victor) Lin",
|
"Author": "Yu Chieh (Victor) Lin",
|
||||||
"Version": "0.80.0",
|
"Version": "0.80.1",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Lin-ycv/EverythingPowerToys",
|
"Website": "https://github.com/Lin-ycv/EverythingPowerToys",
|
||||||
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",
|
"ExecuteFileName": "Community.PowerToys.Run.Plugin.Everything.dll",
|
||||||
|
Loading…
Reference in New Issue
Block a user