mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-07-02 22:58:34 +00:00
fix(restore-gui): surface registry-backup load failures to the user (#685)
Co-authored-by: Jeffrey <9938813+Raphire@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Displays the Restore Backup wizard dialog.
|
||||
|
||||
.DESCRIPTION
|
||||
Presents a modal wizard that lets the user choose and restore either a
|
||||
registry backup or a Start Menu pinned-apps backup. Returns the user's
|
||||
selection via $window.Tag.
|
||||
|
||||
.PARAMETER Owner
|
||||
Optional parent WPF Window used to host this modal dialog. Defaults to the
|
||||
shared $script:GuiWindow when not supplied.
|
||||
|
||||
.OUTPUTS
|
||||
Hashtable
|
||||
Returns a Hashtable describing the user's choice. Possible shapes:
|
||||
RestoreRegistry - @{ Result='RestoreRegistry'; Backup=<normalizedBackup> }
|
||||
RestoreStartMenu - @{ Result='RestoreStartMenu'; StartMenuScope=<scope>;
|
||||
UseManualBackupFile=<bool>; BackupFilePath=<path|string> }
|
||||
Cancelled - @{ Result='Cancelled' } (from New-RestoreDialogState)
|
||||
#>
|
||||
function Show-RestoreBackupDialog {
|
||||
param(
|
||||
[System.Windows.Window]$Owner = $null
|
||||
@@ -295,9 +316,16 @@ function Show-RestoreBackupDialog {
|
||||
}
|
||||
|
||||
Write-Host "Backup file selected: $($openDialog.FileName)"
|
||||
$selectedBackup = Load-RegistryBackupFromFile -FilePath $openDialog.FileName
|
||||
|
||||
if (-not (& $showRegistryOverview -SelectedBackup $selectedBackup -SelectedBackupFilePath $openDialog.FileName)) {
|
||||
try {
|
||||
$selectedBackup = Load-RegistryBackupFromFile -FilePath $openDialog.FileName
|
||||
|
||||
if (-not (& $showRegistryOverview -SelectedBackup $selectedBackup -SelectedBackupFilePath $openDialog.FileName)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Show-MessageBox -Owner $window -Title 'Invalid Backup File' -Message "The selected file could not be loaded:`n$($_.Exception.Message)" -Button 'OK' -Icon 'Error' | Out-Null
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user