Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 1 addition & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,64 +144,8 @@ jobs:
$ErrorActionPreference = "Stop"
$version = "${{ steps.version.outputs.tag }}"
New-Item -ItemType Directory -Force -Path "artifacts/release/packages" | Out-Null
New-Item -ItemType Directory -Force -Path "artifacts/release/package-staging" | Out-Null

$sharedUninstall = "artifacts/release/package-staging/uninstall.bat"
$sharedLicense = "artifacts/release/package-staging/LICENSE.md"

$uninstallContent = @'
@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 Uninstaller
echo ======================================================
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_Launch" /F >nul 2>&1
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] Removing ThreadPilot user data for this Windows account...
rem Full uninstall removes only ThreadPilot-owned per-user AppData. Normal install/update paths never run this script.
if exist "%APPDATA%\ThreadPilot" (
rd /s /q "%APPDATA%\ThreadPilot"
echo ThreadPilot user data removed.
) else (
echo No ThreadPilot user data folder found.
)

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 $sharedUninstall -Value $uninstallContent -Encoding Ascii
Copy-Item "LICENSE" -Destination $sharedLicense -Force

$portableStage = "artifacts/release/package-staging/portable"
New-Item -ItemType Directory -Force -Path $portableStage | Out-Null

Copy-Item "artifacts/release/singlefile/*" -Destination $portableStage -Recurse -Force

Copy-Item $sharedUninstall -Destination (Join-Path $portableStage "uninstall.bat") -Force
Copy-Item $sharedLicense -Destination (Join-Path $portableStage "LICENSE.md") -Force

$portableZip = "artifacts/release/packages/ThreadPilot_$version`_Portable.zip"

Compress-Archive -Path "$portableStage/*" -DestinationPath $portableZip -Force
./build/package-release-zips.ps1 -Version $version -PublishDirectory artifacts/release/singlefile -OutputDirectory artifacts/release/packages

- name: Generate checksums
shell: pwsh
Expand Down
56 changes: 54 additions & 2 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public partial class App : System.Windows.Application
private const string LaunchedViaTaskArgument = "--launched-via-task";

private Mutex? singleInstanceMutex;
private EventWaitHandle? uninstallShutdownSignal;
private string[]? storeCleanupArguments;
private bool serviceProviderDisposed;
private int uiExceptionDialogOpen;
private DateTime lastUiExceptionDialogUtc = DateTime.MinValue;

Expand All @@ -39,13 +42,43 @@ public App()
this.ServiceProvider = services.BuildServiceProvider();

// Validate service configuration
ServiceConfiguration.ValidateServiceConfiguration(this.ServiceProvider);
if (!Environment.GetCommandLineArgs().Contains(UninstallCleanup.Argument))
{
ServiceConfiguration.ValidateServiceConfiguration(this.ServiceProvider);
}
}



internal void ScheduleStoreCleanup(bool purge, bool restore)
{
var args = new List<string> { UninstallCleanup.Argument };
if (!purge)
{
args.Add("--keep-data");
}

if (!restore)
{
args.Add("--keep-windows-changes");
}

this.storeCleanupArguments = args.ToArray();
}

protected override void OnStartup(StartupEventArgs e)
{
if (e.Args.Contains(UninstallCleanup.Argument))
{
this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
var result = UninstallCleanup.Run(
e.Args,
() => this.ServiceProvider.GetRequiredService<IGameSessionService>().RecoverForUninstallAsync(),
this.DisposeServiceProvider);
this.Shutdown(result);
return;
}

// Parse command line arguments early so special startup modes can short-circuit normal flow.
var startupMode = StartupMode.Parse(e.Args);
bool effectiveStartMinimized = false;
Expand Down Expand Up @@ -223,6 +256,19 @@ protected override void OnStartup(StartupEventArgs e)

var mainWindow = this.ServiceProvider.GetRequiredService<MainWindow>();
this.MainWindow = mainWindow;
try
{
this.uninstallShutdownSignal = UninstallCleanup.RegisterShutdown(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
TaskSafety.FireAndForget(mainWindow.ShutdownForUninstallAsync(), _ => { })));
});
}
catch (Exception ex) when (ex is UnauthorizedAccessException or System.IO.IOException)
{
logger.LogWarning(ex, "Could not register graceful close for uninstall");
}


// Handle startup behavior with comprehensive error handling
try
Expand Down Expand Up @@ -371,7 +417,12 @@ protected override void OnExit(ExitEventArgs e)
this.DispatcherUnhandledException -= this.OnDispatcherUnhandledException;
TaskScheduler.UnobservedTaskException -= this.OnUnobservedTaskException;

this.uninstallShutdownSignal?.Dispose();
this.DisposeServiceProvider();
if (this.storeCleanupArguments != null)
{
UninstallCleanup.Run(this.storeCleanupArguments, fromStoreWindow: true);
}

if (this.singleInstanceMutex != null)
{
Expand All @@ -392,12 +443,13 @@ protected override void OnExit(ExitEventArgs e)

private void DisposeServiceProvider()
{
if (this.ServiceProvider is not IDisposable disposableProvider)
if (this.serviceProviderDisposed || this.ServiceProvider is not IDisposable disposableProvider)
{
return;
}

var logger = this.ServiceProvider.GetService<ILogger<App>>();
this.serviceProviderDisposed = true;
try
{
disposableProvider.Dispose();
Expand Down
7 changes: 7 additions & 0 deletions Helpers/DwmHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public static class DwmHelper
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref int pvAttribute, int cbAttribute);

internal static void RoundPopupCorners(IntPtr handle)
{
const int windowCornerPreference = 33;
var roundSmall = 3;
_ = DwmSetWindowAttribute(handle, windowCornerPreference, ref roundSmall, sizeof(int));
}

public static void ApplyWindowCaptionTheme(Window window, bool useDarkTheme)
{
ArgumentNullException.ThrowIfNull(window);
Expand Down
40 changes: 30 additions & 10 deletions Installer/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ArchitecturesInstallIn64BitMode=x64compatible
ArchitecturesAllowed=x64compatible
MinVersion=10.0.17763
UninstallDisplayIcon={app}\{#MyAppExeName}
; Replace the legacy uninstall log, which contained unconditional recursive AppData deletion.
UninstallLogMode=overwrite
DisableReadyPage=yes
; Always Program Files: ThreadPilot runs elevated, and only there can a non-admin program not replace it.
; Installs in another folder move here on upgrade (see MovePreviousInstall below).
Expand Down Expand Up @@ -69,17 +71,8 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait; Check: IsThreadPilotUpdate

; ThreadPilot user data is preserved during install/update. Inno removes installed
; files and shortcuts automatically only when the generated uninstaller runs.
; Per-user AppData cleanup is limited to the account context used by uninstall.
[UninstallRun]
Filename: "taskkill.exe"; Parameters: "/IM ""{#MyAppExeName}"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallKillThreadPilot"
Filename: "schtasks.exe"; Parameters: "/Delete /TN ""ThreadPilot_Launch"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotLaunchTask"
Filename: "schtasks.exe"; Parameters: "/Delete /TN ""ThreadPilot_Startup"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotStartupTask"
Filename: "reg.exe"; Parameters: "delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\Run"" /v ""ThreadPilot"" /f"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotRunEntry"

[UninstallDelete]
Type: filesandordirs; Name: "{userappdata}\ThreadPilot"
Type: dirifempty; Name: "{app}"

[Code]
const
Expand Down Expand Up @@ -184,6 +177,33 @@ begin
MovePreviousInstall();
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Parameters: string;
ExitCode: Integer;
begin
if CurUninstallStep <> usUninstall then
exit;

Parameters := '--prepare-uninstall';
if UninstallSilent then
begin
Parameters := Parameters + ' --silent';
if ExpandConstant('{param:PURGEDATA|1}') = '0' then
Parameters := Parameters + ' --keep-data';
if ExpandConstant('{param:RESTOREWINDOWS|1}') = '0' then
Parameters := Parameters + ' --keep-windows-changes';
end;

Log('ThreadPilot cleanup options: ' + Parameters);
if not Exec(ExpandConstant('{app}\{#MyAppExeName}'), Parameters, ExpandConstant('{app}'),
SW_SHOWNORMAL, ewWaitUntilTerminated, ExitCode) then
RaiseException('Could not start ThreadPilot cleanup.');
Log(Format('ThreadPilot cleanup exit code: %d. Silent residual reports are in Windows Temp\ThreadPilot-uninstall-*.', [ExitCode]));
if (ExitCode <> 0) and (ExitCode <> 1) then
Abort;
end;

function IsThreadPilotUpdate(): Boolean;
begin
Result := CompareText(ExpandConstant('{param:THREADPILOTUPDATE|0}'), '1') = 0;
Expand Down
38 changes: 34 additions & 4 deletions Locales/de-DE.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,28 @@
<sys:String x:Key="ProcessView_CpuSetsFromOther">manuell, von der App selbst oder von einem anderen Tool gesetzt</sys:String>
<sys:String x:Key="ProcessView_CurrentIdealProcessors">Aktuelle ideale Prozessoren: CPU {0}</sys:String>
<sys:String x:Key="ProcessView_NoCpuSetsNote">keine CPU-Sets, Windows wählt die Kerne</sys:String>
<sys:String x:Key="ProcessView_CpuSetsNotAMask">CPU Sets sind aktiv. Das ist nicht die Maske All Cores.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiagnostic">CPU-Set-Diagnose</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiagnosticTooltip">Liest den Prozessstandard und Thread-Overrides. Der Prozess wird nicht geändert.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_NoProcess">Wähle einen Prozess, um seine CPU Sets zu lesen. Der Lesevorgang ändert den Prozess nicht.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_Failed">CPU Sets konnten nicht gelesen werden.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_Summary">{0} Threads erben den Prozessstandard; {1} haben ein explizites Override; {2} Lesevorgänge verweigert; {3} Threads während des Lesens beendet; {4} unvollständige Lesevorgänge.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_ThreadsUnlisted">Die Threadliste konnte nicht gelesen werden. Die Zusammenfassung oben enthält sie nicht.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_PartialBanner">Lesen unvollständig oder verweigert. Fehlende Threads sind nicht Threads, die den Prozessstandard erben.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_NotRunningCpu">Das sind von Windows gelesene Zuweisungen, nicht die CPU, auf der der Thread gerade läuft.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_More">Und {0} weitere Threads wurden nicht aufgeführt.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_DefaultNone">Prozessstandard: keiner. Threads ohne Override platziert Windows.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_DefaultDenied">Prozessstandard: Lesen verweigert.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_DefaultUnavailable">Prozessstandard: nicht lesbar.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_DefaultPartial">Prozessstandard: unvollständig gelesen, {0}.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_DefaultRead">Prozessstandard: {0}.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_ThreadDenied">TID {0}: Lesen verweigert.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_ThreadEnded">TID {0}: Thread während des Lesens beendet.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_ThreadUnread">TID {0}: nicht gelesen.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_OverridePartial">TID {0}: explizites Override, unvollständig gelesen, {1}.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_Override">TID {0}: explizites Override, {1}.</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_Ideal">Ideale CPU {0} (nicht die CPU, auf der er läuft).</sys:String>
<sys:String x:Key="ProcessView_CpuSetDiag_RigidAffinity">Die harte Affinität enthält diese Zuweisung nicht.</sys:String>
<sys:String x:Key="ProcessView_ApplyAffinity">Kerne anwenden</sys:String>
<sys:String x:Key="ProcessView_ApplyAffinityTooltip">Wendet die CPU-Auswahl im gewählten Modus an und überprüft den Windows-Status</sys:String>
<sys:String x:Key="ProcessView_ApplyAffinitySaveRule">CPU-Zuweisung anwenden und als Regel speichern</sys:String>
Expand Down Expand Up @@ -453,7 +475,9 @@
<sys:String x:Key="SettingsView_OpenDiscord">Discord öffnen</sys:String>
<sys:String x:Key="SettingsView_IssuesDescription">Melde Fehler oder unerwartetes Verhalten über GitHub Issues.</sys:String>
<sys:String x:Key="SettingsView_ReportIssue">Problem melden</sys:String>
<sys:String x:Key="SettingsView_About">Über</sys:String>
<sys:String x:Key="SettingsView_CleanupBeforeUninstall">Vor der Deinstallation bereinigen</sys:String>
<sys:String x:Key="SettingsView_CleanupBeforeUninstallDescription">Externe Daten entfernen und Windows wiederherstellen, bevor das Store-Paket entfernt wird.</sys:String>
<sys:String x:Key="SettingsView_About">Updates und Über ThreadPilot</sys:String>
<sys:String x:Key="SettingsView_Copyright">Copyright © 2026 PrimeBuild</sys:String>
<sys:String x:Key="SettingsView_License">Lizenz: AGPLv3</sys:String>
<sys:String x:Key="SettingsView_CheckUpdates">Suchen Sie nach Updates</sys:String>
Expand Down Expand Up @@ -590,7 +614,11 @@
<sys:String x:Key="GameBoost_Mode">Modus</sys:String>
<sys:String x:Key="GameBoost_Mode_Automatic">Automatisch</sys:String>
<sys:String x:Key="GameBoost_Mode_Isolation">Isolation</sys:String>
<sys:String x:Key="GameBoost_Mode_Description">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps), versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS) und hält das Spiel auf CPUs mit zwei gleichen CCDs auf CCD0.</sys:String>
<sys:String x:Key="GameBoost_Mode_Description">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps) und versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS). Auf dieser CPU platziert Windows das Spiel.</sys:String>
<sys:String x:Key="GameBoost_Isolation_Intel">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps), versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS) und hält das Spiel auf den P-Cores.</sys:String>
<sys:String x:Key="GameBoost_Isolation_AmdEqual">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps), versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS) und hält das Spiel auf CPUs mit zwei gleichen CCDs auf CCD0.</sys:String>
<sys:String x:Key="GameBoost_Isolation_AmdVCache">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps), versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS) und hält das Spiel auf dem CCD mit 3D V-Cache.</sys:String>
<sys:String x:Key="GameBoost_Isolation_Generic">Isolation verschiebt zusätzlich weitere Neben-Apps (Launcher-Helfer, Mediaplayer, Office-Apps) und versetzt die ausgewählten Hintergrund-Apps in den Effizienzmodus (EcoQoS). Auf dieser CPU platziert Windows das Spiel.</sys:String>
<sys:String x:Key="GameBoost_AboveNormal_Name">Spielpriorität auf Höher als normal setzen</sys:String>
<sys:String x:Key="GameBoost_AboveNormal_Description">Experimentell: in deinen Spielen messen. Niemals Hoch oder Echtzeit.</sys:String>
<sys:String x:Key="GameBoost_Lists">Spiele und Apps</sys:String>
Expand Down Expand Up @@ -640,8 +668,9 @@
<sys:String x:Key="SystemTray_SelectedProcessFormat">Ausgewählt: {0}</sys:String>
<sys:String x:Key="SystemTray_ApplyPendingToSelected">Ausstehende Einstellungen auf den ausgewählten Prozess anwenden</sys:String>
<sys:String x:Key="SystemTray_ApplyPendingToProcessFormat">Ausstehende Einstellungen auf {0} anwenden</sys:String>
<sys:String x:Key="SystemTray_PowerPlans">🔋 Energiepläne</sys:String>
<sys:String x:Key="SystemTray_Profiles">📋 Profile</sys:String>
<sys:String x:Key="SystemTray_PowerPlans">Energiepläne</sys:String>
<sys:String x:Key="SystemTray_Profiles">Profile</sys:String>
<sys:String x:Key="SystemTray_UpdateAvailable">Update verfügbar — v{0}</sys:String>
<sys:String x:Key="SystemTray_Settings">Einstellungen</sys:String>
<sys:String x:Key="SystemTray_Exit">Beenden</sys:String>
<sys:String x:Key="SystemTray_NoProfilesAvailable">Keine Profile verfügbar</sys:String>
Expand Down Expand Up @@ -770,6 +799,7 @@
<sys:String x:Key="SettingsView_ShortcutShowWindow">ThreadPilot ein- oder ausblenden</sys:String>
<sys:String x:Key="SettingsView_ShortcutMonitoring">Überwachungsbenachrichtigung</sys:String>
<sys:String x:Key="SettingsView_ShortcutPerformance">Benachrichtigung für Höchstleistung</sys:String>
<sys:String x:Key="SettingsView_ShortcutOpenTrayMenu">Infobereichsmenü öffnen</sys:String>
<sys:String x:Key="SettingsView_ShortcutTweaks">Systemoptimierungen öffnen</sys:String>
<sys:String x:Key="SettingsView_ShortcutKey">Taste für das Kürzel</sys:String>
<sys:String x:Key="Settings_ShortcutUnavailable">{0} ist nicht verfügbar. Wählen Sie eine Taste mit Modifikator und eine verfügbare Kombination.</sys:String>
Expand Down
Loading
Loading