mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06: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:
parent
1f683d3f78
commit
ba45c3303e
@ -67,6 +67,7 @@
|
|||||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||||
"ButtonForegroundColor": "#232629",
|
"ButtonForegroundColor": "#232629",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
"ToggleButtonOffColor": "#707070",
|
||||||
"BorderColor": "#232629",
|
"BorderColor": "#232629",
|
||||||
"BorderOpacity": "0.2"
|
"BorderOpacity": "0.2"
|
||||||
|
|
||||||
@ -100,7 +101,8 @@
|
|||||||
"ButtonBackgroundMouseoverColor": "#3B4252",
|
"ButtonBackgroundMouseoverColor": "#3B4252",
|
||||||
"ButtonBackgroundSelectedColor": "#5E81AC",
|
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||||
"ButtonForegroundColor": "#F7F7F7",
|
"ButtonForegroundColor": "#F7F7F7",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
"ToggleButtonOffColor": "#707070",
|
||||||
"BorderColor": "#2F373D",
|
"BorderColor": "#2F373D",
|
||||||
"BorderOpacity": "0.2"
|
"BorderOpacity": "0.2"
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
function Remove-Features() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
@ -62,17 +62,32 @@ function Invoke-WPFGetIso {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
if ($sync["ISOmanual"].IsChecked) {
|
||||||
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
# Open file dialog to let user choose the ISO file
|
||||||
$openFileDialog.initialDirectory = $initialDirectory
|
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||||
$openFileDialog.filter = "ISO files (*.iso)| *.iso"
|
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
||||||
$openFileDialog.ShowDialog() | Out-Null
|
$openFileDialog.initialDirectory = $initialDirectory
|
||||||
$filePath = $openFileDialog.FileName
|
$openFileDialog.filter = "ISO files (*.iso)| *.iso"
|
||||||
|
$openFileDialog.ShowDialog() | Out-Null
|
||||||
|
$filePath = $openFileDialog.FileName
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($filePath)) {
|
if ([string]::IsNullOrEmpty($filePath)) {
|
||||||
Write-Host "No ISO is chosen"
|
Write-Host "No ISO is chosen"
|
||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
return
|
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)"
|
Write-Host "File path $($filePath)"
|
||||||
|
@ -370,6 +370,37 @@ Add-Type @"
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Add event handlers for the RadioButtons
|
||||||
|
$sync["ISOdownloader"].add_Checked({
|
||||||
|
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible
|
||||||
|
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible
|
||||||
|
})
|
||||||
|
|
||||||
|
$sync["ISOmanual"].add_Checked({
|
||||||
|
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||||
|
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||||
|
})
|
||||||
|
|
||||||
|
$sync["ISORelease"].Items.Add("23H2") | Out-Null
|
||||||
|
$sync["ISORelease"].Items.Add("22H2") | Out-Null
|
||||||
|
$sync["ISORelease"].Items.Add("21H2") | Out-Null
|
||||||
|
$sync["ISORelease"].SelectedItem = "23H2"
|
||||||
|
|
||||||
|
$currentCulture = Get-FidoLangFromCulture -langName (Get-Culture).Name
|
||||||
|
|
||||||
|
$sync["ISOLanguage"].Items.Add($currentCulture) | Out-Null
|
||||||
|
if ($currentCulture -ne "English International") {
|
||||||
|
$sync["ISOLanguage"].Items.Add("English International") | Out-Null
|
||||||
|
}
|
||||||
|
if ($currentCulture -ne "English") {
|
||||||
|
$sync["ISOLanguage"].Items.Add("English") | Out-Null
|
||||||
|
}
|
||||||
|
if ($sync["ISOLanguage"].Items.Count -eq 1) {
|
||||||
|
$sync["ISOLanguage"].IsEnabled = $false
|
||||||
|
}
|
||||||
|
$sync["ISOLanguage"].SelectedItem = $currentCulture
|
||||||
|
|
||||||
|
|
||||||
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
||||||
$filter = Get-WinUtilVariables -Type CheckBox
|
$filter = Get-WinUtilVariables -Type CheckBox
|
||||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
||||||
|
@ -366,6 +366,47 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style TargetType="RadioButton">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}"/>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}"/>
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource FontSize}" />
|
||||||
|
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="RadioButton">
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="{DynamicResource CheckBoxMargin}">
|
||||||
|
<Grid Width="14" Height="14">
|
||||||
|
<Ellipse x:Name="OuterCircle"
|
||||||
|
Stroke="{DynamicResource ToggleButtonOffColor}"
|
||||||
|
Fill="{DynamicResource ButtonBackgroundColor}"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Width="14"
|
||||||
|
Height="14"
|
||||||
|
SnapsToDevicePixels="True"/>
|
||||||
|
<Ellipse x:Name="InnerCircle"
|
||||||
|
Fill="{DynamicResource ToggleButtonOnColor}"
|
||||||
|
Width="8"
|
||||||
|
Height="8"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<ContentPresenter Margin="4,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
RecognizesAccessKey="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="InnerCircle" Property="Visibility" Value="Visible"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="OuterCircle" Property="Stroke" Value="{DynamicResource ToggleButtonOnColor}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
<Style x:Key="ToggleSwitchStyle" TargetType="CheckBox">
|
<Style x:Key="ToggleSwitchStyle" TargetType="CheckBox">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
@ -495,8 +536,8 @@
|
|||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="ToggleButton.IsChecked" Value="False">
|
<Trigger Property="ToggleButton.IsChecked" Value="False">
|
||||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MainBackgroundColor}" />
|
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MainBackgroundColor}" />
|
||||||
<Setter TargetName="Border" Property="BorderBrush" Value="#707070" />
|
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonOffColor}" />
|
||||||
<Setter TargetName="Ellipse" Property="Fill" Value="#707070" />
|
<Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource ToggleButtonOffColor}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||||
@ -1038,10 +1079,14 @@
|
|||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Foreground="{DynamicResource LabelboxForegroundColor}"
|
Foreground="{DynamicResource LabelboxForegroundColor}"
|
||||||
/>
|
/>
|
||||||
|
<RadioButton x:Name="ISOmanual" Content="Select your own ISO" GroupName="Options" Margin="0,10,0,0" IsChecked="True"/>
|
||||||
|
<RadioButton x:Name="ISOdownloader" Content="Get newest ISO automatically" GroupName="Options" Margin="0,5,0,5"/>
|
||||||
|
<ComboBox x:Name="ISORelease" Visibility="Collapsed"/>
|
||||||
|
<ComboBox x:Name="ISOLanguage" Visibility="Collapsed"/>
|
||||||
<Button Name="WPFGetIso" Margin="2" Padding="15">
|
<Button Name="WPFGetIso" Margin="2" Padding="15">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<TextBlock Background="Transparent" Foreground="{DynamicResource ButtonForegroundColor}">
|
<TextBlock Background="Transparent" Foreground="{DynamicResource ButtonForegroundColor}">
|
||||||
Select Windows <Underline>I</Underline>SO
|
Get Windows <Underline>I</Underline>SO
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
@ -1136,7 +1181,10 @@
|
|||||||
<LineBreak/>
|
<LineBreak/>
|
||||||
|
|
||||||
<Bold>INSTRUCTIONS</Bold> <LineBreak/>
|
<Bold>INSTRUCTIONS</Bold> <LineBreak/>
|
||||||
- <TextBlock Name="Win11DownloadLink" Style="{StaticResource HoverTextBlockStyle}" ToolTip="https://www.microsoft.com/software-download/windows11">Download</TextBlock> the latest Windows 11 image from Microsoft <LineBreak/>
|
- Download a Windows 11 ISO through the following options: <LineBreak/>
|
||||||
|
<TextBlock Margin="15,0,0,0" Text="- Select your own ISO: Manually download the latest Windows 11 image from " Foreground="{DynamicResource ComboBoxForegroundColor}"/>
|
||||||
|
<TextBlock Name="Win11DownloadLink" Style="{StaticResource HoverTextBlockStyle}" ToolTip="https://www.microsoft.com/software-download/windows11">Microsoft</TextBlock>. <LineBreak/>
|
||||||
|
<TextBlock Margin="15,0,0,0" Text="- Get newest ISO automatically: Choose Windows 11 Edition and preferred language." Foreground="{DynamicResource ComboBoxForegroundColor}"/> <LineBreak/>
|
||||||
May take several minutes to process the ISO depending on your machine and connection <LineBreak/>
|
May take several minutes to process the ISO depending on your machine and connection <LineBreak/>
|
||||||
- Put it somewhere on the C:\ drive so it is easily accessible <LineBreak/>
|
- Put it somewhere on the C:\ drive so it is easily accessible <LineBreak/>
|
||||||
- Launch WinUtil and MicroWin <LineBreak/>
|
- Launch WinUtil and MicroWin <LineBreak/>
|
||||||
|
Loading…
Reference in New Issue
Block a user