From cea227fd63de0da9822b4fe4eadad5264a997a90 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Mon, 26 Aug 2024 17:11:15 +0300 Subject: [PATCH] Change output info from 'Write-Warning' to 'Write-Host' to make sure it's displayed even in RunSpaces as well as PowerShell 5 Environments --- functions/private/Set-WinUtilUITheme.ps1 | 4 ++-- scripts/main.ps1 | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/private/Set-WinUtilUITheme.ps1 b/functions/private/Set-WinUtilUITheme.ps1 index a5bd78fa..bd89aa5c 100644 --- a/functions/private/Set-WinUtilUITheme.ps1 +++ b/functions/private/Set-WinUtilUITheme.ps1 @@ -65,8 +65,8 @@ function Set-WinUtilUITheme { } } catch { - Write-Debug "[Set-WinUtilTheme] Unable to apply theme" - Write-Debug $psitem.Exception.Message + Write-Host "[Set-WinUtilTheme] Unable to apply theme" -ForegroundColor Red + Write-Host "$($psitem.Exception.Message)" -ForegroundColor Red $inputXML = "" # Make inputXML equal an empty string, indicating something went wrong to the function caller. } diff --git a/scripts/main.ps1 b/scripts/main.ps1 index ffc6d6c1..b1e436aa 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -64,8 +64,8 @@ if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) { $inputXML = Set-WinUtilUITheme -inputXML $inputXML -customThemeName $ctttheme if ($inputXML -eq "") { - Write-Warning "Failed to statically apply theming to xaml content using Set-WinUtilTheme, please check previous Error/Warning messages." - Write-Warning "Quitting winutil..." + Write-Host "Failed to statically apply theming to xaml content using Set-WinUtilTheme, please check previous Error/Warning messages." -ForegroundColor Red + Write-Host "Quitting winutil..." -ForegroundColor Red $sync.runspace.Dispose() $sync.runspace.Close() [System.GC]::Collect() @@ -93,8 +93,8 @@ try { } if (-NOT ($readerOperationSuccessful)) { - Write-Warning "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method." - Write-Warning "Quitting winutil..." + Write-Host "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method." -ForegroundColor Red + Write-Host "Quitting winutil..." -ForegroundColor Red $sync.runspace.Dispose() $sync.runspace.Close() [System.GC]::Collect()