From 125e78be962c2fc8bcff12f9d47806967c9d5835 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Sat, 2 Nov 2024 00:04:19 +0100 Subject: [PATCH] refractor PR - remove "Segoe Fluent Icons" changes - add Invoke-WPFGetIso improvements from #2731 > read image once, then take info from the result of that. --- config/themes.json | 2 +- functions/public/Invoke-WPFGetIso.ps1 | 30 ++++++++++++++++++++------- xaml/inputXML.xaml | 25 ++++++---------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/config/themes.json b/config/themes.json index d3cc20ad..18f55b56 100644 --- a/config/themes.json +++ b/config/themes.json @@ -19,7 +19,7 @@ "IconFontSize": "14", "IconButtonSize": "35", "SettingsIconFontSize": "18", - "CloseIconFontSize": "12", + "CloseIconFontSize": "18", "MicroWinLogoSize": "10", "MicrowinCheckBoxMargin": "-10,5,0,0", "GroupBorderBackgroundColor": "#232629", diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 954ee432..e43312ad 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -260,19 +260,33 @@ function Invoke-WPFGetIso { $wimFile = $wimFile.Replace(".wim", ".esd").Trim() } $sync.MicrowinWindowsFlavors.Items.Clear() - Get-WindowsImage -ImagePath $wimFile | ForEach-Object { + + # Store the results of Get-WindowsImage in a variable + $images = Get-WindowsImage -ImagePath $wimFile + + $proEditionIndex = -1 + $proeditionfound = $false + + # Populate the list of Windows flavors and find the Pro edition + $images | ForEach-Object { $imageIdx = $_.ImageIndex $imageName = $_.ImageName $sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName") - } - $sync.MicrowinWindowsFlavors.SelectedIndex = 0 - Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want." - Get-WindowsImage -ImagePath $wimFile | ForEach-Object { - if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") { - # We have found the Pro edition - $sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1 + + # Check if the image name contains 'Pro' + if ($imageName -like "*Pro*" -and !$proeditionfound) { + $proEditionIndex = $imageIdx + $proeditionfound = $true } } + + # Set the selected index to the Pro edition if found, otherwise default to the first item + if ($proEditionIndex -ne -1) { + $sync.MicrowinWindowsFlavors.SelectedIndex = $proEditionIndex - 1 + } else { + $sync.MicrowinWindowsFlavors.SelectedIndex = 0 + } + Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....." diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 5374f0c5..db6894f4 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -617,22 +617,9 @@ - - - - - - - - - - - - - - - - + + + @@ -887,7 +874,7 @@ Width="{DynamicResource IconButtonSize}" Height="{DynamicResource IconButtonSize}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,5,5,0" - FontFamily="Segoe Fluent Icons" + FontFamily="Segoe MDL2 Assets" Content=""/>