Files
fast_install/build.bat
T

94 lines
2.8 KiB
Batchfile

@echo off
chcp 65001 >nul
echo ========================================
echo R0对战平台安装/更新程序 - 构建脚本
echo ========================================
echo.
:: 设置路径
set SCRIPT_DIR=%~dp0
set INSTALLER_DIR=%SCRIPT_DIR%R0Installer
set PATCHGEN_DIR=%SCRIPT_DIR%R0PatchGenerator
set OUTPUT_DIR=%SCRIPT_DIR%
set MSBUILD="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
:: 检查MSBuild是否存在
if not exist %MSBUILD% (
echo [错误] 未找到 MSBuild.exe
echo 请确保已安装 .NET Framework 4.8
pause
exit /b 1
)
echo [1/5] 清理旧文件...
if exist "%INSTALLER_DIR%\bin\Release\R0Installer.exe" del /f "%INSTALLER_DIR%\bin\Release\R0Installer.exe"
if exist "%OUTPUT_DIR%R0Installer.exe" del /f "%OUTPUT_DIR%R0Installer.exe"
if exist "%PATCHGEN_DIR%\bin\Release\R0PatchGenerator.exe" del /f "%PATCHGEN_DIR%\bin\Release\R0PatchGenerator.exe"
if exist "%OUTPUT_DIR%R0PatchGenerator.exe" del /f "%OUTPUT_DIR%R0PatchGenerator.exe"
:: 编译 R0Installer
echo [2/5] 正在编译 R0Installer...
cd /d "%INSTALLER_DIR%"
%MSBUILD% R0Installer.csproj /p:Configuration=Release /verbosity:minimal /nologo
if %ERRORLEVEL% NEQ 0 (
echo.
echo [错误] R0Installer 编译失败!
pause
exit /b 1
)
echo [3/5] 复制 R0Installer...
copy /y "bin\Release\R0Installer.exe" "%OUTPUT_DIR%R0Installer.exe" >nul
:: 编译 R0PatchGenerator
if exist "%PATCHGEN_DIR%" (
echo [4/5] 正在编译 R0PatchGenerator...
cd /d "%PATCHGEN_DIR%"
%MSBUILD% R0PatchGenerator.csproj /p:Configuration=Release /verbosity:minimal /nologo
if %ERRORLEVEL% NEQ 0 (
echo [警告] R0PatchGenerator 编译失败!
) else (
echo [5/5] 复制 R0PatchGenerator...
copy /y "bin\Release\R0PatchGenerator.exe" "%OUTPUT_DIR%R0PatchGenerator.exe" >nul
)
) else (
echo [4/5] 跳过 R0PatchGenerator (目录不存在)
echo [5/5] 跳过
)
cd /d "%SCRIPT_DIR%"
echo.
echo ========================================
echo 构建完成!
echo ========================================
echo.
:: 显示 R0Installer 文件信息
if exist "%OUTPUT_DIR%R0Installer.exe" (
for %%A in ("%OUTPUT_DIR%R0Installer.exe") do (
set /a SIZE_KB=%%~zA / 1024
)
call echo R0Installer.exe: %%SIZE_KB%% KB
)
:: 显示 R0PatchGenerator 文件信息
if exist "%OUTPUT_DIR%R0PatchGenerator.exe" (
for %%A in ("%OUTPUT_DIR%R0PatchGenerator.exe") do (
set /a SIZE_KB2=%%~zA / 1024
)
call echo R0PatchGenerator.exe: %%SIZE_KB2%% KB
)
echo.
echo 使用说明:
echo 安装模式: R0Installer.exe
echo 更新模式: R0Installer.exe update ^<版本号^>
echo 生成增量包: R0PatchGenerator.exe ^<旧版本目录^> ^<新版本目录^> ^<输出.zip^> [从版本] [到版本]
echo.
echo 注意: 增量包生成需要 hdiffz.exe,更新需要 hpatchz.exe
echo.
pause