mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 00:54:47 -05:00
Microwin ISO downloader (#2581)
* try1 * little fix * change back to using Fido * little update * fix some stuff * fix (maybe?) * remove architecture selection * add somewhat of a lang support (needs improvement) * WIP: refractor of existing logic & addition of language selection * WIP: correct lang display (not working rn) * improve, fix and more - call ed with default windows edition (Home/Pro/Edu) - fix language combobox logic - add @CodingWonders 's "Get-FidoLangFromCulture" - hide comboboxes if manual ISO selection is toggled * little output fix - added | Out-Null to combobox item additions to prevent unneeded console output * improve coloring - using ToggleButtonOnColor for Radiobuttons - add theme color ToggleButtonOffColor and use where needed * fix lang * fix "en-" lang remove (United States) bc it is wrong and not accepted by fido/ms * always add "English" * fix theming - add ToggleButtonOffColor to all themes * fix merge issue * update instructions * update ui - manual download is primary option - radiobuttons renamed to refrect what they are - fix styling of instruction - add margin to radiobuttons * fix by adding line break to instructions * fix merge issues
This commit is contained in:
@ -25,6 +25,56 @@ function Test-CompatibleImage() {
|
||||
}
|
||||
}
|
||||
|
||||
function Get-FidoLangFromCulture {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string] $langName
|
||||
)
|
||||
|
||||
switch -Wildcard ($langName)
|
||||
{
|
||||
"ar*" { return "Arabic" }
|
||||
"pt-BR" { return "Brazilian Portuguese" }
|
||||
"bg*" { return "Bulgarian" }
|
||||
{($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" }
|
||||
{($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" }
|
||||
"hr*" { return "Croatian" }
|
||||
"cs*" { return "Czech" }
|
||||
"da*" { return "Danish" }
|
||||
"nl*" { return "Dutch" }
|
||||
"en-US" { return "English" }
|
||||
{($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" }
|
||||
"et*" { return "Estonian" }
|
||||
"fi*" { return "Finnish" }
|
||||
{($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" }
|
||||
"fr-CA" { return "French Canadian" }
|
||||
"de*" { return "German" }
|
||||
"el*" { return "Greek" }
|
||||
"he*" { return "Hebrew" }
|
||||
"hu*" { return "Hungarian" }
|
||||
"it*" { return "Italian" }
|
||||
"ja*" { return "Japanese" }
|
||||
"ko*" { return "Korean" }
|
||||
"lv*" { return "Latvian" }
|
||||
"lt*" { return "Lituanian" }
|
||||
"nb*" { return "Norwegian" }
|
||||
"pl*" { return "Polish" }
|
||||
{($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" }
|
||||
"ro*" { return "Romanian" }
|
||||
"ru*" { return "Russian" }
|
||||
"sr-Latn*" { return "Serbian Latin" }
|
||||
"sk*" { return "Slovak" }
|
||||
"sl*" { return "Slovenian" }
|
||||
{($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" }
|
||||
"es-MX" { return "Spanish (Mexico)" }
|
||||
"sv*" { return "Swedish" }
|
||||
"th*" { return "Thai" }
|
||||
"tr*" { return "Turkish" }
|
||||
"uk*" { return "Ukrainian" }
|
||||
default { return "English" }
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-Features() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
@ -62,17 +62,32 @@ 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["ISOmanual"].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
|
||||
if ([string]::IsNullOrEmpty($filePath)) {
|
||||
Write-Host "No ISO is chosen"
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
return
|
||||
}
|
||||
} elseif ($sync["ISOdownloader"].IsChecked) {
|
||||
# Auto download newest ISO
|
||||
# Credit: https://github.com/pbatard/Fido
|
||||
$fidopath = "$env:temp\Fido.ps1"
|
||||
$originalLocation = Get-Location
|
||||
|
||||
Invoke-WebRequest "https://github.com/pbatard/Fido/raw/master/Fido.ps1" -OutFile $fidopath
|
||||
|
||||
Set-Location -Path $env:temp
|
||||
& $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang $sync["ISOLanguage"].SelectedItem -Ed "Windows 11 Home/Pro/Edu"
|
||||
Set-Location $originalLocation
|
||||
$filePath = Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
}
|
||||
|
||||
Write-Host "File path $($filePath)"
|
||||
|
Reference in New Issue
Block a user