diff --git a/functions/private/Set-WinUtilTaskbarItem.ps1 b/functions/private/Set-WinUtilTaskbarItem.ps1 index 93a8d534..e08d0eb6 100644 --- a/functions/private/Set-WinUtilTaskbarItem.ps1 +++ b/functions/private/Set-WinUtilTaskbarItem.ps1 @@ -25,6 +25,8 @@ function Set-WinUtilTaskbaritem { - Set-WinUtilTaskbaritem -overlay "logo" Checkmark preset: - Set-WinUtilTaskbaritem -overlay "checkmark" + Warning preset: + - Set-WinUtilTaskbaritem -overlay "warning" No overlay: - Set-WinUtilTaskbaritem -overlay "None" Custom icon: @@ -95,7 +97,10 @@ function Set-WinUtilTaskbaritem { $sync["Form"].taskbarItemInfo.Overlay = (ConvertTo-Bitmap -imageFilePath "$env:LOCALAPPDATA\winutil\cttlogo.png") } 'checkmark' { - $sync["Form"].taskbarItemInfo.Overlay = (ConvertTo-Bitmap -imageFilePath "$env:LOCALAPPDATA\winutil\cttcheckmark.png"]) + $sync["Form"].taskbarItemInfo.Overlay = (ConvertTo-Bitmap -imageFilePath "$env:LOCALAPPDATA\winutil\checkmark.png"]) + } + 'warning' { + $sync["Form"].taskbarItemInfo.Overlay = (ConvertTo-Bitmap -imageFilePath "$env:LOCALAPPDATA\winutil\warning.png"]) } 'None' { $sync["Form"].taskbarItemInfo.Overlay = $null diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 9d00ffe9..01390dc1 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -107,7 +107,7 @@ function Invoke-WPFGetIso { { # It's critical and we can't continue. Output an error Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations." - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } else @@ -126,7 +126,7 @@ function Invoke-WPFGetIso { Write-Error "Failed to mount the image. Error: $($_.Exception.Message)" Write-Error "This is NOT winutil's problem, your ISO might be corrupt, or there is a problem on the system" Write-Error "Please refer to this wiki for more details https://github.com/ChrisTitusTech/winutil/blob/main/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting%2Cmd" - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } # storing off values in hidden fields for further steps @@ -204,7 +204,7 @@ function Invoke-WPFGetIso { $msg = "Neither install.wim nor install.esd exist in the image, this could happen if you use unofficial Windows images. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/" Write-Host $msg [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error) - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" throw } elseif ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf)) diff --git a/functions/public/Invoke-WPFInstall.ps1 b/functions/public/Invoke-WPFInstall.ps1 index 93d605d0..b4b0cf21 100644 --- a/functions/public/Invoke-WPFInstall.ps1 +++ b/functions/public/Invoke-WPFInstall.ps1 @@ -64,7 +64,7 @@ function Invoke-WPFInstall { Write-Host "===========================================" Write-Host "Error: $_" Write-Host "===========================================" - $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" }) + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } $sync.ProcessRunning = $False } diff --git a/functions/public/Invoke-WPFMicrowin.ps1 b/functions/public/Invoke-WPFMicrowin.ps1 index 2ec487bc..b54e2625 100644 --- a/functions/public/Invoke-WPFMicrowin.ps1 +++ b/functions/public/Invoke-WPFMicrowin.ps1 @@ -40,7 +40,7 @@ public class PowerManagement { if ($SaveDialog.FileName -eq "") { Write-Host "No file name for the target image was specified" - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } @@ -78,7 +78,7 @@ public class PowerManagement { $msg = "The export process has failed and MicroWin processing cannot continue" Write-Host "Failed to export the image" [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error) - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } } @@ -92,7 +92,7 @@ public class PowerManagement { $dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers." Write-Host $msg [System.Windows.MessageBox]::Show($dlg_msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Exclamation) - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } @@ -101,7 +101,7 @@ public class PowerManagement { if (-not $mountDirExists -or -not $scratchDirExists) { Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist." - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } @@ -116,7 +116,7 @@ public class PowerManagement { else { Write-Host "Could not mount image. Exiting..." - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } @@ -386,7 +386,7 @@ public class PowerManagement { if (-not (Test-Path -Path "$mountDir\sources\install.wim")) { Write-Error "Something went wrong and '$mountDir\sources\install.wim' doesn't exist. Please report this bug to the devs" - Set-WinUtilTaskbaritem -state "Error" -value 1 + Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning" return } Write-Host "Windows image completed. Continuing with boot.wim." diff --git a/functions/public/Invoke-WPFUnInstall.ps1 b/functions/public/Invoke-WPFUnInstall.ps1 index fd8b3f55..e0195ada 100644 --- a/functions/public/Invoke-WPFUnInstall.ps1 +++ b/functions/public/Invoke-WPFUnInstall.ps1 @@ -73,7 +73,7 @@ function Invoke-WPFUnInstall { Write-Host "===========================================" Write-Host "Error: $_" Write-Host "===========================================" - $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" }) + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } $sync.ProcessRunning = $False diff --git a/scripts/main.ps1 b/scripts/main.ps1 index f1d65ee2..ea79507c 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -450,10 +450,15 @@ if (-NOT (Test-Path -Path $winutildir["logo.ico"])) { ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"] } -$winutildir["checkmark.png"] = $winutildir["path"] + "cttcheckmark.png" +$winutildir["checkmark.png"] = $winutildir["path"] + "checkmark.png" +$winutildir["warning.png"] = $winutildir["path"] + "warning.png" if (-NOT (Test-Path -Path $winutildir["checkmark.png"])) { Invoke-WebRequest -Uri "https://christitus.com/images/checkmark.png" -OutFile $winutildir["checkmark.png"] } +if (-NOT (Test-Path -Path $winutildir["warning.png"])) { + Invoke-WebRequest -Uri "https://christitus.com/images/warning.png" -OutFile $winutildir["warning.png"] +} + Set-WinUtilTaskbaritem -overlay "logo" | Out-Null