mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-04-03 14:06:27 +00:00
Refactor feature handling, update format in Features.json
This commit is contained in:
@@ -30,7 +30,7 @@ function ExecuteParameter {
|
||||
$undoRegFile = Join-Path 'Undo' $undoRegFile
|
||||
}
|
||||
|
||||
ImportRegistryFile "> $($undoFeature.UndoAction) $($undoFeature.Label)" $undoRegFile
|
||||
ImportRegistryFile "> $($undoFeature.UndoText)" $undoRegFile
|
||||
return
|
||||
}
|
||||
|
||||
@@ -219,19 +219,13 @@ function ExecuteAllChanges {
|
||||
$stepName = $paramKey
|
||||
if ($script:Features.ContainsKey($paramKey)) {
|
||||
$feature = $script:Features[$paramKey]
|
||||
if ($undoChanges -and $feature.UndoAction) {
|
||||
$stepName = "$($feature.UndoAction) $($feature.Label)"
|
||||
if ($undoChanges -and $feature.UndoText) {
|
||||
$stepName = $feature.UndoText
|
||||
}
|
||||
elseif ($feature.ApplyText) {
|
||||
# Prefer explicit ApplyText when provided
|
||||
$stepName = $feature.ApplyText
|
||||
} elseif ($feature.Label) {
|
||||
# Fallback: construct a name from Action and Label, or just Label
|
||||
if ($feature.Action) {
|
||||
$stepName = "$($feature.Action) $($feature.Label)"
|
||||
} else {
|
||||
$stepName = $feature.Label
|
||||
}
|
||||
} elseif ($feature.Action) {
|
||||
$stepName = $feature.Action
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,4 +235,4 @@ function ExecuteAllChanges {
|
||||
|
||||
ExecuteParameter -paramKey $paramKey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ function RestartExplorer {
|
||||
foreach ($paramKey in $script:Params.Keys) {
|
||||
if ($script:Features.ContainsKey($paramKey) -and $script:Features[$paramKey].RequiresReboot -eq $true) {
|
||||
$feature = $script:Features[$paramKey]
|
||||
Write-Host "Warning: '$($feature.Action) $($feature.Label)' requires a reboot to take full effect" -ForegroundColor Yellow
|
||||
Write-Host "Warning: '$($feature.Action)' requires a reboot to take full effect" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user