mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Compare commits
9 Commits
24.10.07
...
c8ccb8527d
Author | SHA1 | Date | |
---|---|---|---|
c8ccb8527d | |||
f63c312f22 | |||
fcd339d54d | |||
ea2a92fb1e | |||
07b20cd23d | |||
838716e2f4 | |||
7cc5725136 | |||
0ee9972edf | |||
86a0b9bd03 |
@ -248,7 +248,7 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
|
||||
function New-Unattend {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string] $userName,
|
||||
[Parameter(Mandatory, Position = 0)] [string]$userName,
|
||||
[Parameter(Position = 1)] [string] $userPassword
|
||||
)
|
||||
|
||||
|
@ -62,17 +62,33 @@ 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
|
||||
if ([string]::IsNullOrEmpty($filePath)) {
|
||||
Write-Host "No ISO is chosen"
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
return
|
||||
}
|
||||
} elseif ($sync["ISOoption1"].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
|
||||
|
||||
# TODO: Have to correct the language to actually be a working one
|
||||
Set-Location -Path $env:temp
|
||||
& $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64"
|
||||
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)"
|
||||
|
@ -356,6 +356,27 @@ Add-Type @"
|
||||
|
||||
})
|
||||
|
||||
$locale = (Get-Culture).Name
|
||||
|
||||
$sync["ISORelease"].Items.Add("23H2")
|
||||
$sync["ISORelease"].Items.Add("22H2")
|
||||
$sync["ISORelease"].Items.Add("21H2")
|
||||
$sync["ISORelease"].SelectedItem = "23H2"
|
||||
|
||||
$sync["ISOLanguage"].Items.Add($locale)
|
||||
if ($locale -ne "en-US") {
|
||||
$sync["ISOLanguage"].Items.Add("en-US")
|
||||
}
|
||||
$sync["ISOLanguage"].SelectedItem = $locale
|
||||
|
||||
if ($sync["ISOoption1"].IsChecked) {
|
||||
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible
|
||||
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible
|
||||
} else {
|
||||
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||
$sync["ISOLanguage"].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 }
|
||||
|
@ -340,6 +340,47 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="RadioButton">
|
||||
<Setter Property="Foreground" Value="{MainForegroundColor}"/>
|
||||
<Setter Property="Background" Value="{MainBackgroundColor}"/>
|
||||
<Setter Property="FontSize" Value="{FontSize}" />
|
||||
<Setter Property="FontFamily" Value="{FontFamily}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<StackPanel Orientation="Horizontal" Margin="{CheckBoxMargin}">
|
||||
<Grid Width="14" Height="14">
|
||||
<Ellipse x:Name="OuterCircle"
|
||||
Stroke="{ButtonBackgroundPressedColor}"
|
||||
Fill="{ButtonBackgroundColor}"
|
||||
StrokeThickness="1"
|
||||
Width="14"
|
||||
Height="14"
|
||||
SnapsToDevicePixels="True"/>
|
||||
<Ellipse x:Name="InnerCircle"
|
||||
Fill="{MainForegroundColor}"
|
||||
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="{BorderColor}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="CheckBox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
@ -925,10 +966,14 @@
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{LabelboxForegroundColor}"
|
||||
/>
|
||||
<RadioButton x:Name="ISOoption1" Content="Get newest ISO automatically" GroupName="Options" IsChecked="True"/>
|
||||
<ComboBox x:Name="ISORelease"/>
|
||||
<ComboBox x:Name="ISOLanguage"/>
|
||||
<RadioButton x:Name="ISOoption2" Content="Select your own ISO" GroupName="Options"/>
|
||||
<Button Name="WPFGetIso" Margin="2" Padding="15">
|
||||
<Button.Content>
|
||||
<TextBlock Background="Transparent" Foreground="{ButtonForegroundColor}">
|
||||
Select Windows <Underline>I</Underline>SO
|
||||
Get Windows <Underline>I</Underline>SO
|
||||
</TextBlock>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
Reference in New Issue
Block a user