Refactor feature handling, update format in Features.json

This commit is contained in:
Raphire
2026-04-01 21:33:24 +02:00
parent 105198e396
commit c79c05f286
9 changed files with 410 additions and 415 deletions

View File

@@ -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
}
}
}

View File

@@ -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
}
}