From 931e9d13f724efcf6538469a4a74eb900b1fdc5d Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Sat, 15 Feb 2025 11:46:04 -0800 Subject: [PATCH] Fixed USBDriveList json formatting --- FFUDevelopment/BuildFFUVM_UI.ps1 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/FFUDevelopment/BuildFFUVM_UI.ps1 b/FFUDevelopment/BuildFFUVM_UI.ps1 index 4e48c58..f662e1f 100644 --- a/FFUDevelopment/BuildFFUVM_UI.ps1 +++ b/FFUDevelopment/BuildFFUVM_UI.ps1 @@ -186,13 +186,9 @@ function Get-UIConfig { $installApps = $window.FindName('chkInstallApps').IsChecked # Add USB drive selection to config - $selectedUSBDrives = $window.FindName('lstUSBDrives').Items | Where-Object { $_.IsSelected } | ForEach-Object { - @{ - Model = $_.Model - SerialNumber = $_.SerialNumber - DeviceID = $_.DeviceID - Size = $_.Size - } + $selectedUSBDrives = @{} + $window.FindName('lstUSBDrives').Items | Where-Object { $_.IsSelected } | ForEach-Object { + $selectedUSBDrives[$_.Model] = $_.SerialNumber } # Build configuration hashtable (unsorted) @@ -851,10 +847,8 @@ $btnLoadConfig.Add_Click({ # Then select the drives that match the saved configuration foreach ($item in $script:lstUSBDrives.Items) { - if ($configContent.USBDriveList | Where-Object { - $_.Model -eq $item.Model -and - $_.SerialNumber -eq $item.SerialNumber - }) { + if ($configContent.USBDriveList.ContainsKey($item.Model) -and + $configContent.USBDriveList[$item.Model] -eq $item.SerialNumber) { $item.IsSelected = $true } }