feat: EXE 图标支持 (bookworm.ico 16/32/48/256px + rcedit 注入)

This commit is contained in:
bookworm 2026-04-07 01:08:41 +08:00
parent ee8fa10fdc
commit a2a7ff1edb
2 changed files with 23 additions and 8 deletions

BIN
bookworm.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -65,14 +65,21 @@ if ($buildSetup) {
Write-Host " 输入: $inputPs1" -ForegroundColor Gray Write-Host " 输入: $inputPs1" -ForegroundColor Gray
Write-Host " 输出: $outputExe" -ForegroundColor Gray Write-Host " 输出: $outputExe" -ForegroundColor Gray
Invoke-ps2exe ` $iconFile = Join-Path $ScriptDir "bookworm.ico"
-InputFile $inputPs1 ` $ps2exeArgs = @{
-OutputFile $outputExe ` InputFile = $inputPs1
-Title "Bookworm Portable Setup" ` OutputFile = $outputExe
-Description "Bookworm Smart Assistant 安装向导" ` Title = "Bookworm Portable Setup"
-Company "Bookworm" ` Description = "Bookworm Smart Assistant 安装向导"
-Version "1.5.0.0" ` Company = "Bookworm"
-NoConsole # 纯 GUI不弹黑色控制台窗口 Version = "1.5.0.0"
NoConsole = $true
}
if (Test-Path $iconFile) {
$ps2exeArgs.IconFile = $iconFile
Write-Host " 图标: $iconFile" -ForegroundColor Gray
}
Invoke-ps2exe @ps2exeArgs
if (Test-Path $outputExe) { if (Test-Path $outputExe) {
$sizeKB = [math]::Round((Get-Item $outputExe).Length / 1KB) $sizeKB = [math]::Round((Get-Item $outputExe).Length / 1KB)
@ -126,6 +133,14 @@ if ($buildAdmin) {
if (Test-Path $outputExe) { if (Test-Path $outputExe) {
$sizeMB = [math]::Round((Get-Item $outputExe).Length / 1MB, 1) $sizeMB = [math]::Round((Get-Item $outputExe).Length / 1MB, 1)
Write-OK "gen-authcode.exe 打包完成 (${sizeMB} MB)" Write-OK "gen-authcode.exe 打包完成 (${sizeMB} MB)"
# 注入图标 (rcedit)
$iconFile = Join-Path $ScriptDir "bookworm.ico"
$rcedit = "$env:APPDATA\npm\node_modules\rcedit\bin\rcedit-x64.exe"
if ((Test-Path $iconFile) -and (Test-Path $rcedit)) {
& $rcedit $outputExe --set-icon $iconFile | Out-Null
Write-OK "gen-authcode.exe 图标注入完成"
}
} else { } else {
Write-Fail "gen-authcode.exe 打包失败" Write-Fail "gen-authcode.exe 打包失败"
exit 1 exit 1