diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 9a0b7455..e82c5e0f 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -62,17 +62,28 @@ function Invoke-WPFGetIso { } } - [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null - $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog - $openFileDialog.initialDirectory = $initialDirectory - $openFileDialog.filter = "ISO files (*.iso)| *.iso" - $openFileDialog.ShowDialog() | Out-Null - $filePath = $openFileDialog.FileName + if ($sync["ISOoption2"].IsChecked) { + # Open file dialog to let user choose the ISO file + [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null + $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog + $openFileDialog.initialDirectory = $initialDirectory + $openFileDialog.filter = "ISO files (*.iso)| *.iso" + $openFileDialog.ShowDialog() | Out-Null + $filePath = $openFileDialog.FileName + + if ([string]::IsNullOrEmpty($filePath)) { + Write-Host "No ISO is chosen" + $sync.BusyMessage.Visibility="Hidden" + return + } + } elseif ($sync["ISOoption1"].IsChecked) { + # Auto download newest ISO + $Win = "Win11" + $Rel = "23H2" + $Outpath = "$env:TEMP\$Win" + "_$Rel.iso" + Invoke-Webrequest -Uri $finalurl -OutFile $Outpath + $filePath = $Outpath - if ([string]::IsNullOrEmpty($filePath)) { - Write-Host "No ISO is chosen" - $sync.BusyMessage.Visibility="Hidden" - return } Write-Host "File path $($filePath)" diff --git a/scripts/main.ps1 b/scripts/main.ps1 index c1d476f4..fc0b9f75 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -356,6 +356,31 @@ Add-Type @" }) +$sync["ISORelease"].Items.Add("23H2") +$sync["ISORelease"].Items.Add("22H2") +$sync["ISORelease"].Items.Add("21H2") +$sync["ISORelease"].SelectedItem = "23H2" + +$sync["ISOLanguage"].Items.Add((Get-Culture).Name) +if ((Get-Culture).Name -ne "en-US") { + $sync["ISOLanguage"].Items.Add("en-US") +} +$sync["ISOLanguage"].SelectedItem = (Get-Culture).Name + +$sync["ISOArchitecture"].Items.Add("64-bit") +$sync["ISOArchitecture"].Items.Add("86-bit") +$sync["ISOArchitecture"].SelectedItem = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture + +if ($sync["ISOoption1"].IsChecked) { + $sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible + $sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible + $sync["ISOArchitecture"].Visibility = [System.Windows.Visibility]::Visible +} else { + $sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed + $sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed + $sync["ISOArchitecture"].Visibility = [System.Windows.Visibility]::Collapsed +} + # Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons $filter = Get-WinUtilVariables -Type CheckBox $CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter } diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 639c95fb..4ef28177 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -340,6 +340,47 @@ +