Files
ThreadPilot/build-release.ps1
T
PrimeBuild-pc 010dee679f Add docs, themes, services and UI updates
Large changeset adding documentation, themes, converters and wiring between UI and services. Key changes:

- Rewrote .gitignore to standardize build, IDE, OS and project-specific ignores.
- Added comprehensive documentation: ADVANCED_CPU_FEATURES.md, API_REFERENCE.md, ARCHITECTURE_GUIDE.md, DEVELOPER_GUIDE.md, GAME_BOOST_VALIDATION.md, CLAUDE.md, PROJECT_STRUCTURE.md, UI_STYLE_GUIDE.md, TRADEMARK.md.
- Added theme resources (Themes/FluentLight.xaml, Themes/FluentDark.xaml) and merged FluentLight into App.xaml resource dictionary.
- Added NullToBoolConverter and registered it in App.xaml.
- Enabled a DEBUG-only console test mode in App.xaml.cs (--test flag) and guarded AllocConsole with #if DEBUG.
- Added new service/support files (AtomicFileWriter, StoragePaths, ThemeService) and numerous updates across Services (CpuTopologyService, CoreMaskService, PowerPlanService, ProcessMonitorManagerService, ProcessService, NotificationService, SystemTrayService, SystemTweaksService, EnhancedLoggingService, etc.).
- Updated many ViewModels and Views to support new functionality (CPU topology, power plan and game-boost features) and tests (Tests/TestRunner.cs).
- Added build-release.ps1 and various project metadata updates.

Overall this commit introduces documentation, theming, new converters and test/debug support, plus extensive service and UI wiring for CPU topology, process monitoring, power plans and game boost features.
2026-04-10 03:58:51 +02:00

113 lines
3.8 KiB
PowerShell

param(
[string]$Version = "1.0.0",
[string]$Configuration = "Release",
[string]$Runtime = "win-x64"
)
$ErrorActionPreference = "Stop"
function Remove-IfExists {
param([string]$Path)
if (Test-Path -LiteralPath $Path) {
Remove-Item -LiteralPath $Path -Recurse -Force
}
}
$projectRoot = Split-Path -Parent $PSCommandPath
Set-Location -LiteralPath $projectRoot
$outputRoot = Join-Path $projectRoot ("Installer\Output\v" + $Version)
$publishDir = Join-Path $outputRoot "publish"
$portableStage = Join-Path $outputRoot "portable_stage"
$setupStage = Join-Path $outputRoot "setup_stage"
$portableZip = Join-Path $outputRoot ("ThreadPilot_v" + $Version + "_Portable.zip")
$setupZip = Join-Path $outputRoot ("ThreadPilot_v" + $Version + "_Setup.zip")
$uninstallerPath = Join-Path $outputRoot "uninstaller.bat"
Write-Host "Preparing output directories..."
Remove-IfExists -Path $outputRoot
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
Write-Host "Publishing ThreadPilot $Version ($Configuration, $Runtime)..."
dotnet publish "ThreadPilot.csproj" `
--configuration $Configuration `
--runtime $Runtime `
--self-contained true `
/p:PublishSingleFile=true `
/p:EnableCompressionInSingleFile=true `
/p:DebugType=None `
/p:DebugSymbols=false `
/p:PublishTrimmed=false `
-o $publishDir
Write-Host "Creating uninstaller script..."
$uninstallerContent = @'
@echo off
setlocal EnableExtensions
title ThreadPilot Uninstaller
set "APP_DIR=%~dp0"
if "%APP_DIR:~-1%"=="\" set "APP_DIR=%APP_DIR:~0,-1%"
echo ======================================================
echo ThreadPilot v1.0.0 Uninstaller
echo ======================================================
echo.
echo App directory: "%APP_DIR%"
echo.
echo [1/4] Closing running ThreadPilot processes...
taskkill /IM "ThreadPilot.exe" /F >nul 2>&1
echo [2/4] Removing startup task and startup registry entry...
schtasks /Delete /TN "ThreadPilot_Startup" /F >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "ThreadPilot" /f >nul 2>&1
echo [3/4] Optional user data cleanup...
set "REMOVE_DATA=N"
set /p REMOVE_DATA=Do you want to remove user settings at "%APPDATA%\ThreadPilot"? [y/N]:
if /I "%REMOVE_DATA%"=="Y" (
if exist "%APPDATA%\ThreadPilot" (
rd /s /q "%APPDATA%\ThreadPilot"
echo User settings removed.
) else (
echo No user settings folder found.
)
) else (
echo User settings were kept.
)
echo [4/4] Scheduling app folder removal...
start "" /min cmd /c "timeout /t 5 /nobreak >nul & rd /s /q \"%APP_DIR%\""
echo.
echo Uninstall completed. Remaining files will be removed in a few seconds.
endlocal
exit /b 0
'@
Set-Content -LiteralPath $uninstallerPath -Value $uninstallerContent -Encoding Ascii
Write-Host "Packaging portable archive..."
New-Item -ItemType Directory -Path $portableStage -Force | Out-Null
Copy-Item -Path (Join-Path $publishDir "*") -Destination $portableStage -Recurse -Force
Remove-IfExists -Path $portableZip
Compress-Archive -Path (Join-Path $portableStage "*") -DestinationPath $portableZip -CompressionLevel Optimal
Write-Host "Packaging setup archive..."
New-Item -ItemType Directory -Path $setupStage -Force | Out-Null
Copy-Item -Path (Join-Path $publishDir "*") -Destination $setupStage -Recurse -Force
Copy-Item -LiteralPath $uninstallerPath -Destination (Join-Path $setupStage "uninstaller.bat") -Force
Remove-IfExists -Path $setupZip
Compress-Archive -Path (Join-Path $setupStage "*") -DestinationPath $setupZip -CompressionLevel Optimal
Write-Host "Cleaning staging folders..."
Remove-IfExists -Path $portableStage
Remove-IfExists -Path $setupStage
Write-Host "Release packaging complete." -ForegroundColor Green
Write-Host "Portable: $portableZip"
Write-Host "Setup: $setupZip"
Write-Host "Uninstaller script source: $uninstallerPath"