From 1da39b171751a281aa991e003088d715974ebdf9 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 11 Sep 2024 11:40:34 -0500 Subject: [PATCH] Revert "Better Image handling (#2665)" This reverts commit 5059b93cd71522c221be761be409d114b3c2d628. --- config/themes.json | 1 + functions/private/ConvertTo-Icon.ps1 | 92 +++++++++ functions/private/Invoke-WinUtilAssets.ps1 | 199 ------------------- functions/private/Set-WinUtilTaskbarItem.ps1 | 6 +- functions/private/Show-CustomDialog.ps1 | 64 +++++- functions/public/Invoke-WPFShortcut.ps1 | 3 - scripts/main.ps1 | 35 ++-- xaml/inputXML.xaml | 4 +- 8 files changed, 180 insertions(+), 224 deletions(-) create mode 100644 functions/private/ConvertTo-Icon.ps1 delete mode 100644 functions/private/Invoke-WinUtilAssets.ps1 diff --git a/config/themes.json b/config/themes.json index ce1e98889e..dcf4cfb14c 100644 --- a/config/themes.json +++ b/config/themes.json @@ -21,6 +21,7 @@ "TabRowHeightInPixels": "50", "IconFontSize": "14", "IconButtonSize": "35", + "WinUtilIconSize": "Auto", "SettingsIconFontSize": "18", "CloseIconFontSize": "18", diff --git a/functions/private/ConvertTo-Icon.ps1 b/functions/private/ConvertTo-Icon.ps1 new file mode 100644 index 0000000000..a401775551 --- /dev/null +++ b/functions/private/ConvertTo-Icon.ps1 @@ -0,0 +1,92 @@ +function ConvertTo-Icon { + <# + + .DESCRIPTION + This function will convert BMP, GIF, EXIF, JPG, PNG and TIFF to ICO file + + .PARAMETER bitmapPath + The file path to bitmap image to make '.ico' file out of. + Supported file types according to Microsoft Documentation is the following: + BMP, GIF, EXIF, JPG, PNG and TIFF. + + .PARAMETER iconPath + The file path to write the new '.ico' resource. + + .PARAMETER overrideIconFile + An optional boolean Parameter that makes the function overrides + the Icon File Path if the file exists. Defaults to $true. + + .EXAMPLE + try { + ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico" + } catch [System.IO.FileNotFoundException] { + # Handle the thrown exception here... + } + + This Example makes a '.ico' file at "$env:TEMP\cttlogo.ico" File Path using the bitmap file + found in "$env:TEMP\cttlogo.png", the function overrides the '.ico' File if it's found. + this function will throw a FileNotFound Exception at the event of not finding the provided bitmap File Path. + + .EXAMPLE + try { + ConvertTo-Icon "$env:TEMP\cttlogo.png" "$env:TEMP\cttlogo.ico" + } catch [System.IO.FileNotFoundException] { + # Handle the thrown exception here... + } + + This Example is the same as Example 1, but uses Positional Parameters instead. + + .EXAMPLE + if (Test-Path "$env:TEMP\cttlogo.png") { + ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico" + } + + This Example is same as Example 1, but checks if the bitmap File exists before calling 'ConvertTo-Icon' Function. + This's the recommended way of using this function, as it doesn't require any try-catch blocks. + + .EXAMPLE + try { + ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico" -overrideIconFile $false + } catch [System.IO.FileNotFoundException] { + # Handle the thrown exception here... + } + + This Example make use of '-overrideIconFile' Optional Parameter, the default for this parameter is $true. + By doing '-overrideIconFile $false', the 'ConvertTo-Icon' function will raise an exception that needs to be catched throw a 'catch' Code Block, + otherwise it'll crash the running PowerShell instance/process. + + #> + param( + [Parameter(Mandatory, position=0)] + [string]$bitmapPath, + [Parameter(Mandatory, position=1)] + [string]$iconPath, + [Parameter(position=2)] + [bool]$overrideIconFile = $true + ) + + Add-Type -AssemblyName System.Drawing + + if (Test-Path $bitmapPath) { + if ((Test-Path $iconPath) -AND ($overrideIconFile -eq $false)) { + Write-Host "[ConvertTo-Icon] Icon File is found at '$iconPath', and the 'overrideIconFile' Parameter is set to '$overrideIconFile'. Skipping the bitmap to icon convertion..." -ForegroundColor Yellow + return + } + + # Load bitmap file into memory, and make an Icon version out of it + $b = [System.Drawing.Bitmap]::FromFile($bitmapPath) + $icon = [System.Drawing.Icon]::FromHandle($b.GetHicon()) + + # Create the folder for the new icon file if it doesn't exists + $iconFolder = (New-Object System.IO.FileInfo($iconPath)).Directory.FullName + [System.IO.Directory]::CreateDirectory($iconFolder) | Out-Null + + # Write the Icon File and do some cleaning-up + $file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate') + $icon.Save($file) + $file.Close() + $icon.Dispose() + } else { + throw [System.IO.FileNotFoundException] "[ConvertTo-Icon] The provided bitmap File Path is not found at '$bitmapPath'." + } +} diff --git a/functions/private/Invoke-WinUtilAssets.ps1 b/functions/private/Invoke-WinUtilAssets.ps1 deleted file mode 100644 index 6907909e16..0000000000 --- a/functions/private/Invoke-WinUtilAssets.ps1 +++ /dev/null @@ -1,199 +0,0 @@ -function Invoke-WinUtilAssets { - param ( - $type, - $Size, - [switch]$render - ) - - # Create the Viewbox and set its size - $LogoViewbox = New-Object Windows.Controls.Viewbox - $LogoViewbox.Width = $Size - $LogoViewbox.Height = $Size - - # Create a Canvas to hold the paths - $canvas = New-Object Windows.Controls.Canvas - $canvas.Width = 100 - $canvas.Height = 100 - - # Define a scale factor for the content inside the Canvas - $scaleFactor = $Size / 100 - - # Apply a scale transform to the Canvas content - $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) - $canvas.LayoutTransform = $scaleTransform - - switch ($type) { - 'logo' { - $LogoPathData1 = @" -M 18.00,14.00 -C 18.00,14.00 45.00,27.74 45.00,27.74 -45.00,27.74 57.40,34.63 57.40,34.63 -57.40,34.63 59.00,43.00 59.00,43.00 -59.00,43.00 59.00,83.00 59.00,83.00 -55.35,81.66 46.99,77.79 44.72,74.79 -41.17,70.10 42.01,59.80 42.00,54.00 -42.00,51.62 42.20,48.29 40.98,46.21 -38.34,41.74 25.78,38.60 21.28,33.79 -16.81,29.02 18.00,20.20 18.00,14.00 Z -"@ - $LogoPath1 = New-Object Windows.Shapes.Path - $LogoPath1.Data = [Windows.Media.Geometry]::Parse($LogoPathData1) - $LogoPath1.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff") - - $LogoPathData2 = @" -M 107.00,14.00 -C 109.01,19.06 108.93,30.37 104.66,34.21 -100.47,37.98 86.38,43.10 84.60,47.21 -83.94,48.74 84.01,51.32 84.00,53.00 -83.97,57.04 84.46,68.90 83.26,72.00 -81.06,77.70 72.54,81.42 67.00,83.00 -67.00,83.00 67.00,43.00 67.00,43.00 -67.00,43.00 67.99,35.63 67.99,35.63 -67.99,35.63 80.00,28.26 80.00,28.26 -80.00,28.26 107.00,14.00 107.00,14.00 Z -"@ - $LogoPath2 = New-Object Windows.Shapes.Path - $LogoPath2.Data = [Windows.Media.Geometry]::Parse($LogoPathData2) - $LogoPath2.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff") - - $LogoPathData3 = @" -M 19.00,46.00 -C 21.36,47.14 28.67,50.71 30.01,52.63 -31.17,54.30 30.99,57.04 31.00,59.00 -31.04,65.41 30.35,72.16 33.56,78.00 -38.19,86.45 46.10,89.04 54.00,93.31 -56.55,94.69 60.10,97.20 63.00,97.22 -65.50,97.24 68.77,95.36 71.00,94.25 -76.42,91.55 84.51,87.78 88.82,83.68 -94.56,78.20 95.96,70.59 96.00,63.00 -96.01,60.24 95.59,54.63 97.02,52.39 -98.80,49.60 103.95,47.87 107.00,47.00 -107.00,47.00 107.00,67.00 107.00,67.00 -106.90,87.69 96.10,93.85 80.00,103.00 -76.51,104.98 66.66,110.67 63.00,110.52 -60.33,110.41 55.55,107.53 53.00,106.25 -46.21,102.83 36.63,98.57 31.04,93.68 -16.88,81.28 19.00,62.88 19.00,46.00 Z -"@ - $LogoPath3 = New-Object Windows.Shapes.Path - $LogoPath3.Data = [Windows.Media.Geometry]::Parse($LogoPathData3) - $LogoPath3.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#a3a4a6") - - $canvas.Children.Add($LogoPath1) | Out-Null - $canvas.Children.Add($LogoPath2) | Out-Null - $canvas.Children.Add($LogoPath3) | Out-Null - } - 'checkmark' { - $canvas.Width = 512 - $canvas.Height = 512 - - $scaleFactor = $Size / 2.54 - $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) - $canvas.LayoutTransform = $scaleTransform - - # Define the circle path - $circlePathData = "M 1.27,0 A 1.27,1.27 0 1,0 1.27,2.54 A 1.27,1.27 0 1,0 1.27,0" - $circlePath = New-Object Windows.Shapes.Path - $circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData) - $circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#39ba00") - - # Define the checkmark path - $checkmarkPathData = "M 0.873 1.89 L 0.41 1.391 A 0.17 0.17 0 0 1 0.418 1.151 A 0.17 0.17 0 0 1 0.658 1.16 L 1.016 1.543 L 1.583 1.013 A 0.17 0.17 0 0 1 1.599 1 L 1.865 0.751 A 0.17 0.17 0 0 1 2.105 0.759 A 0.17 0.17 0 0 1 2.097 0.999 L 1.282 1.759 L 0.999 2.022 L 0.874 1.888 Z" - $checkmarkPath = New-Object Windows.Shapes.Path - $checkmarkPath.Data = [Windows.Media.Geometry]::Parse($checkmarkPathData) - $checkmarkPath.Fill = [Windows.Media.Brushes]::White - - # Add the paths to the Canvas - $canvas.Children.Add($circlePath) | Out-Null - $canvas.Children.Add($checkmarkPath) | Out-Null - } - 'warning' { - $canvas.Width = 512 - $canvas.Height = 512 - - # Define a scale factor for the content inside the Canvas - $scaleFactor = $Size / 512 # Adjust scaling based on the canvas size - $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) - $canvas.LayoutTransform = $scaleTransform - - # Define the circle path - $circlePathData = "M 256,0 A 256,256 0 1,0 256,512 A 256,256 0 1,0 256,0" - $circlePath = New-Object Windows.Shapes.Path - $circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData) - $circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#f41b43") - - # Define the exclamation mark path - $exclamationPathData = "M 256 307.2 A 35.89 35.89 0 0 1 220.14 272.74 L 215.41 153.3 A 35.89 35.89 0 0 1 251.27 116 H 260.73 A 35.89 35.89 0 0 1 296.59 153.3 L 291.86 272.74 A 35.89 35.89 0 0 1 256 307.2 Z" - $exclamationPath = New-Object Windows.Shapes.Path - $exclamationPath.Data = [Windows.Media.Geometry]::Parse($exclamationPathData) - $exclamationPath.Fill = [Windows.Media.Brushes]::White - - # Get the bounds of the exclamation mark path - $exclamationBounds = $exclamationPath.Data.Bounds - - # Calculate the center position for the exclamation mark path - $exclamationCenterX = ($canvas.Width - $exclamationBounds.Width) / 2 - $exclamationBounds.X - $exclamationPath.SetValue([Windows.Controls.Canvas]::LeftProperty, $exclamationCenterX) - - # Define the rounded rectangle at the bottom (dot of exclamation mark) - $roundedRectangle = New-Object Windows.Shapes.Rectangle - $roundedRectangle.Width = 80 - $roundedRectangle.Height = 80 - $roundedRectangle.RadiusX = 30 - $roundedRectangle.RadiusY = 30 - $roundedRectangle.Fill = [Windows.Media.Brushes]::White - - # Calculate the center position for the rounded rectangle - $centerX = ($canvas.Width - $roundedRectangle.Width) / 2 - $roundedRectangle.SetValue([Windows.Controls.Canvas]::LeftProperty, $centerX) - $roundedRectangle.SetValue([Windows.Controls.Canvas]::TopProperty, 324.34) - - # Add the paths to the Canvas - $canvas.Children.Add($circlePath) | Out-Null - $canvas.Children.Add($exclamationPath) | Out-Null - $canvas.Children.Add($roundedRectangle) | Out-Null - } - default { - Write-Host "Invalid type: $type" - } - } - - # Add the Canvas to the Viewbox - $LogoViewbox.Child = $canvas - - if ($render) { - # Measure and arrange the canvas to ensure proper rendering - $canvas.Measure([Windows.Size]::new($canvas.Width, $canvas.Height)) - $canvas.Arrange([Windows.Rect]::new(0, 0, $canvas.Width, $canvas.Height)) - $canvas.UpdateLayout() - - # Initialize RenderTargetBitmap correctly with dimensions - $renderTargetBitmap = New-Object Windows.Media.Imaging.RenderTargetBitmap($canvas.Width, $canvas.Height, 96, 96, [Windows.Media.PixelFormats]::Pbgra32) - - # Render the canvas to the bitmap - $renderTargetBitmap.Render($canvas) - - # Create a BitmapFrame from the RenderTargetBitmap - $bitmapFrame = [Windows.Media.Imaging.BitmapFrame]::Create($renderTargetBitmap) - - # Create a PngBitmapEncoder and add the frame - $bitmapEncoder = [Windows.Media.Imaging.PngBitmapEncoder]::new() - $bitmapEncoder.Frames.Add($bitmapFrame) - - # Save to a memory stream - $imageStream = New-Object System.IO.MemoryStream - $bitmapEncoder.Save($imageStream) - $imageStream.Position = 0 - - # Load the stream into a BitmapImage - $bitmapImage = [Windows.Media.Imaging.BitmapImage]::new() - $bitmapImage.BeginInit() - $bitmapImage.StreamSource = $imageStream - $bitmapImage.CacheOption = [Windows.Media.Imaging.BitmapCacheOption]::OnLoad - $bitmapImage.EndInit() - - return $bitmapImage - } else { - return $LogoViewbox - } -} diff --git a/functions/private/Set-WinUtilTaskbarItem.ps1 b/functions/private/Set-WinUtilTaskbarItem.ps1 index 6eeb76749a..465ca4c34f 100644 --- a/functions/private/Set-WinUtilTaskbarItem.ps1 +++ b/functions/private/Set-WinUtilTaskbarItem.ps1 @@ -61,13 +61,13 @@ function Set-WinUtilTaskbaritem { if ($overlay) { switch ($overlay) { 'logo' { - $sync["Form"].taskbarItemInfo.Overlay = $sync["logorender"] + $sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\cttlogo.png" } 'checkmark' { - $sync["Form"].taskbarItemInfo.Overlay = $sync["checkmarkrender"] + $sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\checkmark.png" } 'warning' { - $sync["Form"].taskbarItemInfo.Overlay = $sync["warningrender"] + $sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\warning.png" } 'None' { $sync["Form"].taskbarItemInfo.Overlay = $null diff --git a/functions/private/Show-CustomDialog.ps1 b/functions/private/Show-CustomDialog.ps1 index d2bbe08998..7180b60ce2 100644 --- a/functions/private/Show-CustomDialog.ps1 +++ b/functions/private/Show-CustomDialog.ps1 @@ -51,7 +51,7 @@ function Show-CustomDialog { $buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor $buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor $shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA") - $logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor + $logocolor = $sync.configs.themes.$ctttheme.ButtonBackgroundPressedColor # Create a custom dialog window $dialog = New-Object Windows.Window @@ -128,15 +128,73 @@ function Show-CustomDialog { $grid.Children.Add($stackPanel) [Windows.Controls.Grid]::SetRow($stackPanel, 0) # Set the row to the second row (0-based index) + $viewbox = New-Object Windows.Controls.Viewbox + $viewbox.Width = $IconSize + $viewbox.Height = $IconSize + + # Combine the paths into a single string +# $cttLogoPath = @" +# M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z +# M177 711 c-19 -88 4 -242 49 -318 43 -74 107 -127 232 -191 176 -90 199 -84 28 7 -169 91 -214 129 -258 220 -29 58 -32 74 -37 190 -4 90 -8 116 -14 92z +# M1069 610 c-4 -131 -5 -137 -38 -198 -43 -79 -89 -119 -210 -181 -53 -27 -116 -61 -141 -76 -74 -43 -6 -20 115 40 221 109 296 217 294 425 -1 144 -16 137 -20 -10z +# "@ +$cttLogoPath = @" + M 18.00,14.00 + C 18.00,14.00 45.00,27.74 45.00,27.74 + 45.00,27.74 57.40,34.63 57.40,34.63 + 57.40,34.63 59.00,43.00 59.00,43.00 + 59.00,43.00 59.00,83.00 59.00,83.00 + 55.35,81.66 46.99,77.79 44.72,74.79 + 41.17,70.10 42.01,59.80 42.00,54.00 + 42.00,51.62 42.20,48.29 40.98,46.21 + 38.34,41.74 25.78,38.60 21.28,33.79 + 16.81,29.02 18.00,20.20 18.00,14.00 Z + M 107.00,14.00 + C 109.01,19.06 108.93,30.37 104.66,34.21 + 100.47,37.98 86.38,43.10 84.60,47.21 + 83.94,48.74 84.01,51.32 84.00,53.00 + 83.97,57.04 84.46,68.90 83.26,72.00 + 81.06,77.70 72.54,81.42 67.00,83.00 + 67.00,83.00 67.00,43.00 67.00,43.00 + 67.00,43.00 67.99,35.63 67.99,35.63 + 67.99,35.63 80.00,28.26 80.00,28.26 + 80.00,28.26 107.00,14.00 107.00,14.00 Z + M 19.00,46.00 + C 21.36,47.14 28.67,50.71 30.01,52.63 + 31.17,54.30 30.99,57.04 31.00,59.00 + 31.04,65.41 30.35,72.16 33.56,78.00 + 38.19,86.45 46.10,89.04 54.00,93.31 + 56.55,94.69 60.10,97.20 63.00,97.22 + 65.50,97.24 68.77,95.36 71.00,94.25 + 76.42,91.55 84.51,87.78 88.82,83.68 + 94.56,78.20 95.96,70.59 96.00,63.00 + 96.01,60.24 95.59,54.63 97.02,52.39 + 98.80,49.60 103.95,47.87 107.00,47.00 + 107.00,47.00 107.00,67.00 107.00,67.00 + 106.90,87.69 96.10,93.85 80.00,103.00 + 76.51,104.98 66.66,110.67 63.00,110.52 + 60.33,110.41 55.55,107.53 53.00,106.25 + 46.21,102.83 36.63,98.57 31.04,93.68 + 16.88,81.28 19.00,62.88 19.00,46.00 Z +"@ + + # Add SVG path + $svgPath = New-Object Windows.Shapes.Path + $svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath) + $svgPath.Fill = $logocolor # Set fill color to white + + # Add SVG path to Viewbox + $viewbox.Child = $svgPath + # Add SVG path to the stack panel - $stackPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25)) + $stackPanel.Children.Add($viewbox) # Add "Winutil" text $winutilTextBlock = New-Object Windows.Controls.TextBlock $winutilTextBlock.Text = "Winutil" $winutilTextBlock.FontSize = $HeaderFontSize $winutilTextBlock.Foreground = $logocolor - $winutilTextBlock.Margin = New-Object Windows.Thickness(10, 10, 10, 5) # Add margins around the text block + $winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block $stackPanel.Children.Add($winutilTextBlock) # Add TextBlock for information with text wrapping and margins $messageTextBlock = New-Object Windows.Controls.TextBlock diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 index e4e47871ec..6b25bdfe3c 100644 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -51,9 +51,6 @@ function Invoke-WPFShortcut { $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) $Shortcut.TargetPath = $shell $Shortcut.Arguments = $shellArgs - if (-NOT (Test-Path -Path $winutildir["logo.ico"])) { - Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.ico" -OutFile $winutildir["logo.ico"] - } if (Test-Path -Path $winutildir["logo.ico"]) { $shortcut.IconLocation = $winutildir["logo.ico"] } diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 28bf9525b4..26ae8190f0 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -453,25 +453,32 @@ $sync["Form"].Add_Loaded({ $sync["Form"].MaxHeight = [Double]::PositiveInfinity }) -$NavLogoPanel = $sync["Form"].FindName("NavLogoPanel") -$NavLogoPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25)) | Out-Null - # Initialize the hashtable $winutildir = @{} # Set the path for the winutil directory $winutildir["path"] = "$env:LOCALAPPDATA\winutil\" -[System.IO.Directory]::CreateDirectory($winutildir["path"]) | Out-Null +[System.IO.Directory]::CreateDirectory("$winutildir") | Out-Null +# Set the path for the logo and checkmark images +$winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png" $winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico" +if (-NOT (Test-Path -Path $winutildir["logo.png"])) { + Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $winutildir["logo.png"] +} +if (-NOT (Test-Path -Path $winutildir["logo.ico"])) { + ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"] +} -if (Test-Path $winutildir["logo.ico"]) { - $sync["logorender"] = $winutildir["logo.ico"] -} else { - $sync["logorender"] = (Invoke-WinUtilAssets -Type "Logo" -Size 90 -Render) +$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"] } -$sync["checkmarkrender"] = (Invoke-WinUtilAssets -Type "checkmark" -Size 512 -Render) -$sync["warningrender"] = (Invoke-WinUtilAssets -Type "warning" -Size 512 -Render) + Set-WinUtilTaskbaritem -overlay "logo" @@ -520,10 +527,10 @@ Version : - - +