mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
Fix import/export functionality (#4131)
* fix: cast selections to string to prevent PSCustomObject type issues * fix(presets): clear existing selections before importing to replace state instead of merging * refactor(impex): warn user when exporting empty selections or importing empty config
This commit is contained in:
@@ -32,17 +32,17 @@ function Invoke-WPFPresets {
|
||||
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
||||
}
|
||||
|
||||
# clear out the filtered pattern
|
||||
if (!$preset) {
|
||||
switch ($checkboxfilterpattern) {
|
||||
"WPFTweak*" { $sync.selectedTweaks = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFInstall*" { $sync.selectedApps = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFeatures" { $sync.selectedFeatures = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFToggle" { $sync.selectedToggles = [System.Collections.Generic.List[string]]::new() }
|
||||
default {}
|
||||
}
|
||||
# clear out the filtered pattern so applying a preset replaces the current
|
||||
# state rather than merging with it
|
||||
switch ($checkboxfilterpattern) {
|
||||
"WPFTweak*" { $sync.selectedTweaks = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFInstall*" { $sync.selectedApps = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFeatures" { $sync.selectedFeatures = [System.Collections.Generic.List[string]]::new() }
|
||||
"WPFToggle" { $sync.selectedToggles = [System.Collections.Generic.List[string]]::new() }
|
||||
default {}
|
||||
}
|
||||
else {
|
||||
|
||||
if ($preset) {
|
||||
Update-WinUtilSelections -flatJson $CheckBoxesToCheck
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user