ARM dll, verbose installer
This commit is contained in:
Yu Chieh Victor Lin 2024-04-19 15:37:15 +08:00
parent 534b91c064
commit da9cc0a9d7
6 changed files with 55 additions and 45 deletions

View File

@ -3,6 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<LangVersion>12</LangVersion>
<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>
@ -10,22 +11,24 @@
<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>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore> <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
<Company>lin-ycv</Company> <Company>lin-ycv</Company>
<Copyright>Copyright (C) lin-ycv</Copyright> <Copyright>Copyright (C) lin-ycv</Copyright>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> <PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\$(Platform)\$(Configuration)\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'">
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<OutputPath>bin\$(Platform)\$(Configuration)\Everything\</OutputPath>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>none</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
@ -83,6 +86,9 @@
<None Update="Everything64.dll"> <None Update="Everything64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="EverythingARM64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Everything.dark.png"> <None Update="Images\Everything.dark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@ -139,7 +145,7 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="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\CHECKSUM.txt&quot;&#xD;&#xA;powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-x64.zip -Force&#xD;&#xA;&quot;C:\Program Files (x86)\NSIS\makensis&quot; /Dver=$(Version) /Ddirect=$(TargetDir) .\NSIS\exeCreator.nsi&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.zip SHA256 &gt;&gt; .\bin\CHECKSUM.txt&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-x64.exe SHA256 &gt;&gt; .\bin\CHECKSUM.txt" /> <Exec Command="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\CHECKSUM.txt&quot;&#xD;&#xA;powershell Compress-Archive -Path $(TargetDir) -DestinationPath .\bin\EverythingPT-$(Version)-x64+ARM64.zip -Force&#xD;&#xA;&quot;C:\Program Files (x86)\NSIS\makensis&quot; /Dver=$(Version) /Ddirect=$(TargetDir) .\NSIS\exeCreator.nsi&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-x64+ARM64.zip SHA256 &gt;&gt; .\bin\CHECKSUM.txt&#xD;&#xA;certUtil -hashfile .\bin\EverythingPT-$(Version)-x64+ARM64.exe SHA256 &gt;&gt; .\bin\CHECKSUM.txt&#xD;&#xA;rd /Q /S &quot;$(TargetDir)&quot;&#xD;&#xA;rd &quot;$(ProjectDir)obj&quot; /s /q" />
</Target> </Target>
</Project> </Project>

View File

@ -106,8 +106,6 @@ namespace Community.PowerToys.Run.Plugin.Everything.Interop
#endregion #endregion
internal const string dllName = "Everything64.dll"; internal const string dllName = "Everything64.dll";
[LibraryImport(dllName)] [LibraryImport(dllName)]
internal static partial uint Everything_GetLastError();
[LibraryImport(dllName)]
internal static partial uint Everything_GetNumResults(); internal static partial uint Everything_GetNumResults();
[LibraryImport(dllName, EntryPoint = "Everything_GetResultFullPathNameW", StringMarshalling = StringMarshalling.Utf16)] [LibraryImport(dllName, EntryPoint = "Everything_GetResultFullPathNameW", StringMarshalling = StringMarshalling.Utf16)]
internal static partial uint Everything_GetResultFullPathName(uint nIndex, [Out] char[] lpString, uint nMaxCount); internal static partial uint Everything_GetResultFullPathName(uint nIndex, [Out] char[] lpString, uint nMaxCount);

23
Main.cs
View File

@ -1,4 +1,5 @@
using Microsoft.PowerToys.Settings.UI.Library; using System.Runtime.InteropServices;
using Microsoft.PowerToys.Settings.UI.Library;
namespace Community.PowerToys.Run.Plugin.Everything namespace Community.PowerToys.Run.Plugin.Everything
{ {
@ -92,8 +93,28 @@ namespace Community.PowerToys.Run.Plugin.Everything
}, },
}; };
private void CheckArm()
{
string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
arm = Path.Combine(dir, "EverythingARM64.dll");
if (File.Exists(arm))
{
Architecture arch = RuntimeInformation.ProcessArchitecture;
if (arch == Architecture.Arm64)
{
File.Delete(Path.Combine(dir, "Everything64.dll"));
File.Move(arm, Path.Combine(dir, "Everything64.dll"));
}
else
{
File.Delete(arm);
}
}
}
public void Init(PluginInitContext context) public void Init(PluginInitContext context)
{ {
CheckArm();
if (_setting.Updates) if (_setting.Updates)
Task.Run(() => new Update().UpdateAsync(Assembly.GetExecutingAssembly().GetName().Version, _setting)); Task.Run(() => new Update().UpdateAsync(Assembly.GetExecutingAssembly().GetName().Version, _setting));
_everything = new Everything(_setting); _everything = new Everything(_setting);

View File

@ -1,4 +1,4 @@
; Silent switch /S/ ; Silent switch /S
; Pass in /Dver=0.00.0 before calling the script to set the version ; Pass in /Dver=0.00.0 before calling the script to set the version
; ie: makensis /Dver=0.77.0 .\exeCreator.nsi ; ie: makensis /Dver=0.77.0 .\exeCreator.nsi
; Doc: https://nsis.sourceforge.io/Docs/Chapter4.html ; Doc: https://nsis.sourceforge.io/Docs/Chapter4.html
@ -19,50 +19,33 @@ LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
BrandingText "${EPT} v${ver}" BrandingText "${EPT} v${ver}"
CRCCheck force CRCCheck force
FileErrorText "Can't write: $\r$\n$\r$\n$0$\r$\n$\r$\nPowerToys is probaly still running, please close it and retry."
Icon Everything.ico Icon Everything.ico
InstallDir "$LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\Everything" InstallDir "$LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\Everything"
Name "${EPT}" Name "${EPT}"
OutFile ".\..\bin\${EPT}-${ver}-x64.exe" OutFile ".\..\bin\${EPT}-${ver}-x64+ARM64.exe"
RequestExecutionLevel user RequestExecutionLevel user
SetCompressor /SOLID /FINAL lzma SetCompressor /SOLID /FINAL lzma
Unicode True
;-------------------------------- ;--------------------------------
Page directory ;Page directory
Page instfiles Page instfiles
;-------------------------------- ;--------------------------------
Section "" Section ""
;ExecWait '"$%SystemRoot%\system32\TaskKill.exe" /F /IM ${PT}' ClearErrors
SetOutPath $INSTDIR SetOutPath $INSTDIR
GetFullPathName $0 "$EXEDIR\" GetFullPathName $0 "$EXEDIR\"
GetFullPathName $0 $0 GetFullPathName $0 $0
File /r "${direct}\*" File /r "${direct}\*"
IfFileExists "$LOCALAPPDATA\PowerToys\${PT}" 0 +2 IfErrors 0 +5
Exec '"$LOCALAPPDATA\PowerToys\${PT}"' SetErrorlevel 2
IfSilent +2
IfFileExists "$PROGRAMFILES64\PowerToys\${PT}" 0 +2 MessageBox MB_ICONEXCLAMATION "Unable to install, PowerToys is probaly still running, please close it manually before install."
Exec '"$PROGRAMFILES64\PowerToys\${PT}"' Abort
SectionEnd SectionEnd
;--------------------------------
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'
; Pop $R0
; StrCmp $R0 0 +3
; MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
; Abort
FunctionEnd

View File

@ -3,7 +3,7 @@
public class Settings public class Settings
{ {
// Settings from PTR settings // Settings from PTR settings
public Interop.NativeMethods.Sort Sort { get; set; } = Interop.NativeMethods.Sort.DATE_MODIFIED_DESCENDING; public Sort Sort { get; set; } = Sort.DATE_MODIFIED_DESCENDING;
public uint Max { get; set; } = 20; public uint Max { get; set; } = 20;
public string Context { get; set; } = "012345"; public string Context { get; set; } = "012345";
public bool Copy { get; set; } public bool Copy { get; set; }

View File

@ -37,12 +37,14 @@ namespace Community.PowerToys.Run.Plugin.Everything
} }
} }
byte[] fileContent = await httpClient.GetByteArrayAsync(nameUrl[1]); if (nameUrl[0].Length > 0)
string fileName = Path.Combine(Path.GetTempPath(), nameUrl[0]); {
File.WriteAllBytes(fileName, fileContent); byte[] fileContent = await httpClient.GetByteArrayAsync(nameUrl[1]);
using Process updater = Process.Start(fileName); string fileName = Path.Combine(Path.GetTempPath(), nameUrl[0]);
updater.WaitForExit(5000); File.WriteAllBytes(fileName, fileContent);
if (updater.ExitCode == 1) Process.Start(fileName);
}
else
{ {
ProcessStartInfo p = new("https://github.com/lin-ycv/EverythingPowerToys/releases/latest") ProcessStartInfo p = new("https://github.com/lin-ycv/EverythingPowerToys/releases/latest")
{ {