diff --git a/.github/workflows/close-issue-command.yaml b/.github/workflows/close-issue-command.yaml index 0f6aa3fb..e27ba51e 100644 --- a/.github/workflows/close-issue-command.yaml +++ b/.github/workflows/close-issue-command.yaml @@ -62,7 +62,7 @@ jobs: else gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} fi - + - name: Reopen issue if conditions are met if: env.reopen_command == 'true' && env.user == 'true' env: @@ -70,4 +70,4 @@ jobs: ISSUE_NUMBER: ${{ github.event.issue.number }} run: | echo Reopening the issue... - gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }} \ No newline at end of file + gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }} diff --git a/README.md b/README.md index b55bbda2..7a162a07 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win These are the sponsors that help keep this project alive with monthly contributions. -Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanthaddlPaulDave JonesAnthony MendezxPandakuClaudemodsTimothy CookDursleyGuy +Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanthaddlPaulDave JonesAnthony MendezxPandakuClaudemodsTimothy CookDursleyGuyMITH ツ ## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻. diff --git a/config/themes.json b/config/themes.json index 829cfd0e..18f55b56 100644 --- a/config/themes.json +++ b/config/themes.json @@ -73,12 +73,12 @@ }, "Dark": { - "ComboBoxForegroundColor": "#1e3747", - "ComboBoxBackgroundColor": "#232629", + "ComboBoxForegroundColor": "#F7F7F7", + "ComboBoxBackgroundColor": "#1E3747", "LabelboxForegroundColor": "#0567ff", "MainForegroundColor": "#F7F7F7", - "MainBackgroundColor": "#121212", - "LabelBackgroundColor": "#121212", + "MainBackgroundColor": "#232629", + "LabelBackgroundColor": "#232629", "LinkForegroundColor": "#add8e6", "LinkHoverForegroundColor": "#F7F7F7", "ScrollBarBackgroundColor": "#2E3135", diff --git a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 index c607ad69..fff2b6be 100644 --- a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 +++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 @@ -28,7 +28,7 @@ function Test-CompatibleImage() { function Get-FidoLangFromCulture { param ( - [Parameter(Mandatory, Position = 0)] [string] $langName + [Parameter(Mandatory, Position = 0)] [string]$langName ) switch -Wildcard ($langName) diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 98b653d5..954ee432 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -77,17 +77,64 @@ function Invoke-WPFGetIso { return } } elseif ($sync["ISOdownloader"].IsChecked) { + # Create folder browsers for user-specified locations + [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null + $isoDownloaderFBD = New-Object System.Windows.Forms.FolderBrowserDialog + $isoDownloaderFBD.Description = "Please specify the path to download the ISO file to:" + $isoDownloaderFBD.ShowNewFolderButton = $true + if ($isoDownloaderFBD.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK) + { + return + } + + # Grab the location of the selected path + $targetFolder = $isoDownloaderFBD.SelectedPath + # Auto download newest ISO # Credit: https://github.com/pbatard/Fido $fidopath = "$env:temp\Fido.ps1" - $originalLocation = Get-Location + $originalLocation = $PSScriptRoot 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" + # Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture + $lang = if ($sync["ISOLanguage"].SelectedIndex -eq 0) { + Get-FidoLangFromCulture -langName (Get-Culture).Name + } else { + $sync["ISOLanguage"].SelectedItem + } + + & $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang $lang -Ed "Windows 11 Home/Pro/Edu" + if (-not $?) + { + Write-Host "Could not download the ISO file. Look at the output of the console for more information." + $msg = "The ISO file could not be downloaded" + [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error) + return + } Set-Location $originalLocation - $filePath = Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + # Use the FullName property to only grab the file names. Using this property is necessary as, without it, you're passing the usual output of Get-ChildItem + # to the variable, and let's be honest, that does NOT exist in the file system + $filePath = (Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso").FullName | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + $fileName = [IO.Path]::GetFileName("$filePath") + + if (($targetFolder -ne "") -and (Test-Path "$targetFolder")) + { + try + { + # "Let it download to $env:TEMP and then we **move** it to the file path." - CodingWonders + $destinationFilePath = "$targetFolder\$fileName" + Write-Host "Moving ISO file. Please wait..." + Move-Item -Path "$filePath" -Destination "$destinationFilePath" -Force + $filePath = $destinationFilePath + } + catch + { + Write-Host "Unable to move the ISO file to the location you specified. The downloaded ISO is in the `"$env:TEMP`" folder" + Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow + } + } } Write-Host "File path $($filePath)" diff --git a/functions/public/Invoke-WPFImpex.ps1 b/functions/public/Invoke-WPFImpex.ps1 index d97f025e..43d835de 100644 --- a/functions/public/Invoke-WPFImpex.ps1 +++ b/functions/public/Invoke-WPFImpex.ps1 @@ -57,7 +57,6 @@ function Invoke-WPFImpex { } } - $flattenedJson = [string]$flattenedJson Invoke-WPFPresets -preset $flattenedJson -imported $true } } diff --git a/functions/public/Invoke-WPFPresets.ps1 b/functions/public/Invoke-WPFPresets.ps1 index 90493899..1535ffe5 100644 --- a/functions/public/Invoke-WPFPresets.ps1 +++ b/functions/public/Invoke-WPFPresets.ps1 @@ -17,7 +17,7 @@ function Invoke-WPFPresets { param ( [Parameter(position=0)] - [string]$preset = "", + [Array]$preset = "", [Parameter(position=1)] [bool]$imported = $false, @@ -51,7 +51,7 @@ function Invoke-WPFPresets { } # Check if the checkbox name exists in the flattened JSON hashtable - if ($CheckBoxesToCheck.Contains($checkboxName)) { + if ($CheckBoxesToCheck -contains $checkboxName) { # If it exists, set IsChecked to true $sync.$checkboxName.IsChecked = $true Write-Debug "$checkboxName is checked" diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index f4c2d73b..3851536d 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -292,7 +292,7 @@ function Invoke-WPFUIElements { $checkBox.FontSize = $theme.FontSize $checkBox.ToolTip = $entryInfo.Description $checkBox.Margin = $theme.CheckBoxMargin - if ($entryInfo.Checked) { + if ($entryInfo.Checked -eq $true) { $checkBox.IsChecked = $entryInfo.Checked } $horizontalStackPanel.Children.Add($checkBox) | Out-Null diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 61f6845f..873aab4d 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -415,9 +415,7 @@ $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 +$sync["ISOLanguage"].Items.Add("System Language ($(Get-FidoLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null if ($currentCulture -ne "English International") { $sync["ISOLanguage"].Items.Add("English International") | Out-Null } @@ -427,7 +425,7 @@ if ($currentCulture -ne "English") { if ($sync["ISOLanguage"].Items.Count -eq 1) { $sync["ISOLanguage"].IsEnabled = $false } -$sync["ISOLanguage"].SelectedItem = $currentCulture +$sync["ISOLanguage"].SelectedIndex = 0 # Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons