mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-07-20 21:10:20 +08:00
Refactor Get-RebootFeatureLabels to use generic list and simplify feature label collection
This commit is contained in:
parent
c36639414e
commit
545de05e57
@ -18,7 +18,7 @@ function RestartExplorer {
|
||||
return
|
||||
}
|
||||
|
||||
$rebootFeatures = @(Get-RebootFeatureLabels)
|
||||
$rebootFeatures = Get-RebootFeatureLabels
|
||||
foreach ($displayLabel in $rebootFeatures) {
|
||||
Write-Host "Warning: '$displayLabel' requires a reboot to take full effect" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ function Show-ApplyModal {
|
||||
|
||||
# Show completion message with reboot instructions if any applied features require reboot
|
||||
if ($RestartExplorer) {
|
||||
$rebootFeatures = @(Get-RebootFeatureLabels)
|
||||
$rebootFeatures = Get-RebootFeatureLabels
|
||||
|
||||
if ($rebootFeatures.Count -gt 0) {
|
||||
foreach ($featureName in $rebootFeatures) {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
UndoLabel when available.
|
||||
#>
|
||||
function Get-RebootFeatureLabels {
|
||||
$rebootFeatureLabels = @()
|
||||
$rebootFeatureLabels = [System.Collections.Generic.List[string]]::new()
|
||||
$candidateParamKeys = (@($script:Params.Keys) + @($script:UndoParams.Keys)) | Select-Object -Unique
|
||||
|
||||
foreach ($paramKey in $candidateParamKeys) {
|
||||
@ -18,7 +18,7 @@ function Get-RebootFeatureLabels {
|
||||
$displayLabel = if ($isUndo -and $feature.UndoLabel) { $feature.UndoLabel } else { $feature.Label }
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace([string]$displayLabel)) {
|
||||
$rebootFeatureLabels += [string]$displayLabel
|
||||
[void]$rebootFeatureLabels.Add([string]$displayLabel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user