Initial commit: R0Installer source, patch generator, API backend and build scripts
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
# R0对战平台安装程序 - PowerShell构建脚本
|
||||
# 使用方法: 右键 -> 使用PowerShell运行
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host " R0对战平台安装/更新程序 - 构建脚本" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# 设置路径
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$InstallerDir = Join-Path $ScriptDir "R0Installer"
|
||||
$PatchGenDir = Join-Path $ScriptDir "R0PatchGenerator"
|
||||
$OutputDir = $ScriptDir
|
||||
$MSBuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
|
||||
|
||||
# 检查MSBuild是否存在
|
||||
if (-not (Test-Path $MSBuild)) {
|
||||
Write-Host "[错误] 未找到 MSBuild.exe" -ForegroundColor Red
|
||||
Write-Host "请确保已安装 .NET Framework 4.8" -ForegroundColor Red
|
||||
Read-Host "按回车键退出"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 清理旧文件
|
||||
Write-Host "[1/5] 清理旧文件..." -ForegroundColor Yellow
|
||||
$InstallerExe = Join-Path $InstallerDir "bin\Release\R0Installer.exe"
|
||||
$PatchGenExe = Join-Path $PatchGenDir "bin\Release\R0PatchGenerator.exe"
|
||||
$OutputInstallerExe = Join-Path $OutputDir "R0Installer.exe"
|
||||
$OutputPatchGenExe = Join-Path $OutputDir "R0PatchGenerator.exe"
|
||||
if (Test-Path $InstallerExe) { Remove-Item $InstallerExe -Force }
|
||||
if (Test-Path $OutputInstallerExe) { Remove-Item $OutputInstallerExe -Force }
|
||||
if (Test-Path $PatchGenExe) { Remove-Item $PatchGenExe -Force }
|
||||
if (Test-Path $OutputPatchGenExe) { Remove-Item $OutputPatchGenExe -Force }
|
||||
|
||||
# 编译 R0Installer 项目
|
||||
Write-Host "[2/5] 正在编译 R0Installer..." -ForegroundColor Yellow
|
||||
Set-Location $InstallerDir
|
||||
$process = Start-Process -FilePath $MSBuild -ArgumentList "R0Installer.csproj", "/p:Configuration=Release", "/verbosity:minimal", "/nologo" -Wait -PassThru -NoNewWindow
|
||||
|
||||
if ($process.ExitCode -ne 0) {
|
||||
Write-Host ""
|
||||
Write-Host "[错误] R0Installer 编译失败!" -ForegroundColor Red
|
||||
Read-Host "按回车键退出"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 复制 R0Installer 输出文件
|
||||
Write-Host "[3/5] 复制 R0Installer..." -ForegroundColor Yellow
|
||||
Copy-Item $InstallerExe $OutputInstallerExe -Force
|
||||
|
||||
# 编译 R0PatchGenerator 项目
|
||||
if (Test-Path $PatchGenDir) {
|
||||
Write-Host "[4/5] 正在编译 R0PatchGenerator..." -ForegroundColor Yellow
|
||||
Set-Location $PatchGenDir
|
||||
$process = Start-Process -FilePath $MSBuild -ArgumentList "R0PatchGenerator.csproj", "/p:Configuration=Release", "/verbosity:minimal", "/nologo" -Wait -PassThru -NoNewWindow
|
||||
|
||||
if ($process.ExitCode -ne 0) {
|
||||
Write-Host ""
|
||||
Write-Host "[警告] R0PatchGenerator 编译失败!" -ForegroundColor Yellow
|
||||
} else {
|
||||
# 复制 R0PatchGenerator 输出文件
|
||||
Write-Host "[5/5] 复制 R0PatchGenerator..." -ForegroundColor Yellow
|
||||
Copy-Item $PatchGenExe $OutputPatchGenExe -Force
|
||||
}
|
||||
} else {
|
||||
Write-Host "[4/5] 跳过 R0PatchGenerator (目录不存在)" -ForegroundColor Gray
|
||||
Write-Host "[5/5] 跳过" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
Set-Location $ScriptDir
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "========================================" -ForegroundColor Green
|
||||
Write-Host " 构建完成!" -ForegroundColor Green
|
||||
Write-Host "========================================" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# 显示 R0Installer 文件信息
|
||||
if (Test-Path $OutputInstallerExe) {
|
||||
$FileInfo = Get-Item $OutputInstallerExe
|
||||
$SizeKB = [math]::Round($FileInfo.Length / 1KB, 2)
|
||||
Write-Host "R0Installer.exe: $SizeKB KB" -ForegroundColor White
|
||||
}
|
||||
|
||||
# 显示 R0PatchGenerator 文件信息
|
||||
if (Test-Path $OutputPatchGenExe) {
|
||||
$FileInfo = Get-Item $OutputPatchGenExe
|
||||
$SizeKB = [math]::Round($FileInfo.Length / 1KB, 2)
|
||||
Write-Host "R0PatchGenerator.exe: $SizeKB KB" -ForegroundColor White
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "使用说明:" -ForegroundColor Cyan
|
||||
Write-Host " 安装模式: R0Installer.exe" -ForegroundColor White
|
||||
Write-Host " 更新模式: R0Installer.exe update <版本号>" -ForegroundColor White
|
||||
Write-Host " 生成增量包: R0PatchGenerator.exe <旧版本目录> <新版本目录> <输出.zip> [从版本] [到版本]" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "注意: 增量包生成需要 hdiffz.exe,更新需要 hpatchz.exe" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Read-Host "按回车键退出"
|
||||
Reference in New Issue
Block a user