mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
Feature/appx removal tab (#4729)
* feat: add config-driven AppX package removal tab - Add config/appx.json with curated list of removable AppX packages - Add AppX Removal tab (WPFTab6) with Select All, Clear, and Remove buttons - Reuse existing Invoke-WPFUIElements engine for minimal code footprint - Add Invoke-WPFAppxRemoval.ps1 for background runspace package removal - Add theme colors for the new tab button in light and dark modes * yep * yep * yep * yep * Update inputXML.xaml * Update Invoke-WPFButton.ps1 * Update Invoke-WPFButton.ps1 * Update Invoke-WPFSelectedCheckboxesUpdate.ps1 * Update appx.json * Update appx.json * Update appx.json * Update tweaks.json * Update appx.json * Update appx.json * Update appx.json * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFButton.ps1 * Delete functions/public/Invoke-WPFAppxRemoval.ps1 * Revert "Update Invoke-WPFButton.ps1" This reverts commitd8705cc08e. * Revert "Delete functions/public/Invoke-WPFAppxRemoval.ps1" This reverts commit9e45d1ad99. * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFButton.ps1 * yep * Update appx.json * Update appx.json * Update tweaks.json * Update start.ps1 * Update preset.json * Update tweaks.json * yep * yep * yep * yep * yep * yep * Update Invoke-WPFAppxRemoval.ps1 * Update Update-WinUtilSelections.ps1 * Update Update-WinUtilSelections.ps1 * yep * Update Invoke-WPFAppxRemoval.ps1 * yep * yep * Update Invoke-WPFAppxRemoval.ps1 * Update appx.json * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update appx.json * Update Invoke-WPFGetInstalled.ps1 * Update Invoke-WPFAppxRemoval.ps1 * yep * yep * Update Invoke-WPFSelectedCheckboxesUpdate.ps1 * yep * yep * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * yep * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update appx.json * Update Invoke-WPFImpex.ps1 * Update Invoke-WPFImpex.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update preset.json * Update preset.json * Update Invoke-WPFSelectedCheckboxesUpdate.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update tweaks.json * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * Update Invoke-WPFAppxRemoval.ps1 * yep * yep * Update Invoke-WPFAppxRemoval.ps1 * yep * Delete functions/private/Find-AppxByNameOrDescription.ps1 * yep * Update Invoke-WPFButton.ps1 * Update main.ps1 * Update Invoke-WPFTab.ps1 * yep * yep * Update themes.json
This commit is contained in:
@@ -1,52 +1,14 @@
|
||||
function Update-WinUtilSelections {
|
||||
<#
|
||||
function Update-WinUtilSelections ($flatJson) {
|
||||
foreach ($cbkey in $flatJson) {
|
||||
|
||||
.SYNOPSIS
|
||||
Updates the $sync.selected variables with a given preset.
|
||||
|
||||
.PARAMETER flatJson
|
||||
The flattened json list of $sync values to select.
|
||||
#>
|
||||
|
||||
param (
|
||||
$flatJson
|
||||
)
|
||||
|
||||
foreach ($item in $flatJson) {
|
||||
# Ensure each item is treated as a string to handle PSCustomObject from JSON deserialization
|
||||
$cbkey = [string]$item
|
||||
$group = if ($cbkey.StartsWith("WPFInstall")) { "Install" }
|
||||
elseif ($cbkey.StartsWith("WPFTweaks")) { "Tweaks" }
|
||||
elseif ($cbkey.StartsWith("WPFToggle")) { "Toggle" }
|
||||
elseif ($cbkey.StartsWith("WPFFeature")) { "Feature" }
|
||||
else { "na" }
|
||||
|
||||
switch ($group) {
|
||||
"Install" {
|
||||
if (!$sync.selectedApps.Contains($cbkey)) {
|
||||
$sync.selectedApps.Add($cbkey)
|
||||
# The List type needs to be specified again, because otherwise Sort-Object will convert the list to a string if there is only a single entry
|
||||
[System.Collections.Generic.List[string]]$sync.selectedApps = $sync.SelectedApps | Sort-Object
|
||||
}
|
||||
}
|
||||
"Tweaks" {
|
||||
if (!$sync.selectedTweaks.Contains($cbkey)) {
|
||||
$sync.selectedTweaks.Add($cbkey)
|
||||
}
|
||||
}
|
||||
"Toggle" {
|
||||
if (!$sync.selectedToggles.Contains($cbkey)) {
|
||||
$sync.selectedToggles.Add($cbkey)
|
||||
}
|
||||
}
|
||||
"Feature" {
|
||||
if (!$sync.selectedFeatures.Contains($cbkey)) {
|
||||
$sync.selectedFeatures.Add($cbkey)
|
||||
}
|
||||
}
|
||||
default {
|
||||
Write-Host "Unknown group for checkbox: $($cbkey)"
|
||||
}
|
||||
$listName = switch -Regex ($cbkey) {
|
||||
'^WPFInstall' { 'selectedApps' }
|
||||
'^WPFTweaks' { 'selectedTweaks' }
|
||||
'^WPFToggle' { 'selectedToggles' }
|
||||
'^WPFFeature' { 'selectedFeatures' }
|
||||
'^WPFAppx' { 'selectedAppx' }
|
||||
}
|
||||
|
||||
$sync.$listName.Add($cbkey)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user