|
|
@@ -1,118 +1,58 @@
|
|
|
-# 创建 SteamSH 便携式自解压包
|
|
|
-# 将 exe 打包成双击即可运行的便携版
|
|
|
+# Portable packager for Steam求购 custom edition (dakehu).
|
|
|
+# Output: SteamQG_Portable.zip — does NOT overwrite SteamSH_Portable.zip / steamSH_V*.exe
|
|
|
|
|
|
param(
|
|
|
- [string]$SourceExe = "steamSH_standalone.exe",
|
|
|
- [string]$OutputFile = "SteamSH_Portable.exe"
|
|
|
+ [string]$SourceExe = "SteamQG.exe",
|
|
|
+ [string]$OutputFile = "SteamQG_Portable.exe"
|
|
|
)
|
|
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
|
-Write-Host "SteamSH 便携版打包工具" -ForegroundColor Cyan
|
|
|
+Write-Host "SteamQG (Steam求购) portable packager" -ForegroundColor Cyan
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
|
|
|
|
-# 检查输入文件
|
|
|
-Write-Host "`n[1/4] 检查输入文件..." -ForegroundColor Yellow
|
|
|
+Write-Host "`n[1/3] Checking source..." -ForegroundColor Yellow
|
|
|
if (-not (Test-Path $SourceExe)) {
|
|
|
- Write-Host "错误: 找不到源文件 $SourceExe" -ForegroundColor Red
|
|
|
- Write-Host "请先运行构建脚本生成 exe 文件" -ForegroundColor Yellow
|
|
|
+ Write-Host "ERROR: source not found: $SourceExe" -ForegroundColor Red
|
|
|
+ Write-Host "Run tauri build then build-windows.ps1 first." -ForegroundColor Yellow
|
|
|
exit 1
|
|
|
}
|
|
|
-Write-Host " ✓ 找到源文件: $SourceExe" -ForegroundColor Green
|
|
|
+Write-Host " OK: $SourceExe" -ForegroundColor Green
|
|
|
|
|
|
-# 创建临时目录
|
|
|
-Write-Host "`n[2/4] 准备便携包内容..." -ForegroundColor Yellow
|
|
|
-$tempDir = Join-Path $env:TEMP "SteamSH_Portable_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
|
|
|
+Write-Host "`n[2/3] Preparing package folder..." -ForegroundColor Yellow
|
|
|
+$tempDir = Join-Path $env:TEMP "SteamQG_Portable_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
|
|
|
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
|
|
|
|
|
-# 复制 exe
|
|
|
-Copy-Item $SourceExe (Join-Path $tempDir "steamSH.exe") -Force
|
|
|
-Write-Host " ✓ 已复制主程序" -ForegroundColor Green
|
|
|
+Copy-Item $SourceExe (Join-Path $tempDir "SteamQG.exe") -Force
|
|
|
|
|
|
-# 创建启动脚本
|
|
|
-$startBat = @'
|
|
|
+$startBat = @"
|
|
|
@echo off
|
|
|
chcp 65001 >nul
|
|
|
-echo 正在启动 SteamSH...
|
|
|
+echo Starting SteamQG...
|
|
|
cd /d "%~dp0"
|
|
|
-start "" "steamSH.exe"
|
|
|
-'@
|
|
|
-$startBat | Out-File (Join-Path $tempDir "启动SteamSH.bat") -Encoding UTF8
|
|
|
-Write-Host " ✓ 已创建启动脚本" -ForegroundColor Green
|
|
|
-
|
|
|
-# 创建说明文件
|
|
|
-$readme = @'
|
|
|
-SteamSH 便携版
|
|
|
-=============
|
|
|
-
|
|
|
-使用说明:
|
|
|
-1. 双击 "启动SteamSH.bat" 即可启动程序
|
|
|
-2. 或直接运行 steamSH.exe
|
|
|
-
|
|
|
-注意:
|
|
|
-- 这是独立可执行文件,无需安装任何依赖
|
|
|
-- 所有数据会存储在用户目录下
|
|
|
-- 可以直接复制到U盘或移动设备使用
|
|
|
-'@
|
|
|
-$readme | Out-File (Join-Path $tempDir "说明.txt") -Encoding UTF8
|
|
|
-Write-Host " ✓ 已创建说明文件" -ForegroundColor Green
|
|
|
-
|
|
|
-# 压缩为 zip
|
|
|
-Write-Host "`n[3/4] 创建压缩包..." -ForegroundColor Yellow
|
|
|
-$zipFile = "SteamSH_Portable.zip"
|
|
|
+start "" "SteamQG.exe"
|
|
|
+"@
|
|
|
+$startBat | Out-File (Join-Path $tempDir "start.bat") -Encoding UTF8
|
|
|
+
|
|
|
+$readme = @"
|
|
|
+SteamQG Portable (Steam求购 custom edition)
|
|
|
+==========================================
|
|
|
+
|
|
|
+1. Double-click start.bat or SteamQG.exe
|
|
|
+2. Standalone, no install required
|
|
|
+3. Independent from old steamSH / Youdangdang builds
|
|
|
+"@
|
|
|
+$readme | Out-File (Join-Path $tempDir "README.txt") -Encoding UTF8
|
|
|
+Write-Host " OK" -ForegroundColor Green
|
|
|
+
|
|
|
+Write-Host "`n[3/3] Creating zip..." -ForegroundColor Yellow
|
|
|
+$zipFile = "SteamQG_Portable.zip"
|
|
|
if (Test-Path $zipFile) { Remove-Item $zipFile -Force }
|
|
|
-
|
|
|
Compress-Archive -Path (Join-Path $tempDir "*") -DestinationPath $zipFile -Force
|
|
|
-Write-Host " ✓ 已创建 $zipFile" -ForegroundColor Green
|
|
|
-
|
|
|
-# 查找 7z SFX 模块
|
|
|
-Write-Host "`n[4/4] 创建自解压 exe..." -ForegroundColor Yellow
|
|
|
-$sfxModule = $null
|
|
|
-$possiblePaths = @(
|
|
|
- "C:\Program Files\7-Zip\7zSD.sfx",
|
|
|
- "C:\Program Files\2345Soft\HaoZip\sfx\HaoZip7zSetup.sfx",
|
|
|
- "C:\Program Files\2345Soft\HaoZip\sfx\HaoZip7zCon.sfx"
|
|
|
-)
|
|
|
-
|
|
|
-foreach ($path in $possiblePaths) {
|
|
|
- if (Test-Path $path) {
|
|
|
- $sfxModule = $path
|
|
|
- Write-Host " ✓ 找到 SFX 模块: $sfxModule" -ForegroundColor Green
|
|
|
- break
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-if (-not $sfxModule) {
|
|
|
- Write-Host "`n警告: 未找到 7-Zip SFX 模块" -ForegroundColor Yellow
|
|
|
- Write-Host "将只生成 ZIP 压缩包" -ForegroundColor Yellow
|
|
|
- Write-Host "`n提示: 安装 7-Zip 后可创建自解压 exe" -ForegroundColor Cyan
|
|
|
- Write-Host "下载地址: https://www.7-zip.org/" -ForegroundColor Cyan
|
|
|
- exit 0
|
|
|
-}
|
|
|
-
|
|
|
-# 拼接 SFX
|
|
|
-try {
|
|
|
- $sfxBytes = [System.IO.File]::ReadAllBytes($sfxModule)
|
|
|
- $zipBytes = [System.IO.File]::ReadAllBytes($zipFile)
|
|
|
- $outputBytes = $sfxBytes + $zipBytes
|
|
|
- [System.IO.File]::WriteAllBytes($OutputFile, $outputBytes)
|
|
|
+Write-Host " OK: $zipFile ($([math]::Round((Get-Item $zipFile).Length / 1MB, 2)) MB)" -ForegroundColor Green
|
|
|
|
|
|
- $sizeMB = [math]::Round((Get-Item $OutputFile).Length / 1MB, 2)
|
|
|
- Write-Host "`n========================================" -ForegroundColor Green
|
|
|
- Write-Host "便携包构建完成!" -ForegroundColor Green
|
|
|
- Write-Host "========================================" -ForegroundColor Green
|
|
|
- Write-Host "`n输出文件:" -ForegroundColor White
|
|
|
- Write-Host " ZIP 包: $zipFile ($([math]::Round((Get-Item $zipFile).Length / 1MB, 2)) MB)" -ForegroundColor Cyan
|
|
|
- Write-Host " 自解压 exe: $OutputFile ($sizeMB MB)" -ForegroundColor Green
|
|
|
- Write-Host "`n分发方式:" -ForegroundColor White
|
|
|
- Write-Host " 1. 直接分发 $OutputFile 给用户" -ForegroundColor White
|
|
|
- Write-Host " 2. 用户双击即可自动解压并启动" -ForegroundColor White
|
|
|
-} catch {
|
|
|
- Write-Host "错误: 创建 SFX 失败 - $_" -ForegroundColor Red
|
|
|
- exit 1
|
|
|
-}
|
|
|
-
|
|
|
-# 清理临时文件
|
|
|
Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
|
+
|
|
|
+Write-Host "`nDone. Old SteamSH_Portable.zip / steamSH_V*.exe untouched." -ForegroundColor Yellow
|