Skip to content

Commit 4fa52cd

Browse files
committed
Using the installed icon
1 parent 90deaa8 commit 4fa52cd

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

Sources/Winget-AutoUpdate/WAU-Settings-GUI.ps1

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Function Start-PopUp ($Message) {
6363
#Read the form
6464
$Reader = (New-Object System.Xml.XmlNodeReader $XAML)
6565
$Script:PopUpWindow = [Windows.Markup.XamlReader]::Load($Reader)
66-
$PopUpWindow.Icon = $IconBase64
66+
$PopUpWindow.Icon = $Script:WAU_ICON
6767

6868
# Make sure window stays on top (redundant, but ensures behavior)
6969
$PopUpWindow.Topmost = $true
@@ -875,7 +875,7 @@ function Show-WAUSettingsGUI {
875875
[xml]$xamlXML = $Script:WINDOW_XAML -replace 'x:N', 'N'
876876
$reader = (New-Object System.Xml.XmlNodeReader $xamlXML)
877877
$window = [Windows.Markup.XamlReader]::Load($reader)
878-
$window.Icon = $IconBase64
878+
$window.Icon = $Script:WAU_ICON
879879

880880
# Get controls
881881
$controls = @{}
@@ -1349,16 +1349,6 @@ $null = cmd /c ''
13491349
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
13501350
$ProgressPreference = 'SilentlyContinue'
13511351

1352-
# Load icon from config file
1353-
$iconConfigPath = Join-Path $Script:WorkingDir "config\icon.txt"
1354-
if (Test-Path $iconConfigPath) {
1355-
$Script:IconBase64 = [Convert]::FromBase64String((Get-Content $iconConfigPath -Raw).Trim())
1356-
} else {
1357-
# Fallback to default or show error
1358-
Write-Warning "Icon config file not found: $iconConfigPath"
1359-
$Script:IconBase64 = $null
1360-
}
1361-
13621352
# Load PopUp XAML from config file and store as constant
13631353
$xamlConfigPath = Join-Path $Script:WorkingDir "config\settings-popup.xaml"
13641354
if (Test-Path $xamlConfigPath) {
@@ -1390,21 +1380,22 @@ if (Test-Path $xamlConfigPath) {
13901380
exit 1
13911381
}
13921382

1393-
#Pop "Starting..."
1394-
Start-PopUp "Gathering Data..."
1395-
13961383
# Get WAU installation info once and store as constants
13971384
$Script:WAU_INSTALL_INFO = Test-InstalledWAU -DisplayName "Winget-AutoUpdate"
13981385
$Script:WAU_VERSION = if ($Script:WAU_INSTALL_INFO.Count -ge 1) { $Script:WAU_INSTALL_INFO[0] } else { "Unknown" }
1386+
$Script:WAU_GUID = if ($Script:WAU_INSTALL_INFO.Count -ge 2) { $Script:WAU_INSTALL_INFO[1] } else { $null }
1387+
$Script:WAU_ICON = "${env:SystemRoot}\Installer\${Script:WAU_GUID}\icon.ico"
1388+
1389+
#Pop "Starting..."
1390+
Start-PopUp "Gathering Data..."
1391+
13991392
# Get WinGet version by running 'winget -v'
14001393
try {
14011394
$wingetVersionOutput = winget -v 2>$null
14021395
$Script:WINGET_VERSION = $wingetVersionOutput.Trim().TrimStart("v")
14031396
} catch {
14041397
$Script:WINGET_VERSION = "Unknown"
14051398
}
1406-
$Script:WAU_GUID = if ($Script:WAU_INSTALL_INFO.Count -ge 2) { $Script:WAU_INSTALL_INFO[1] } else { $null }
1407-
$Script:WAU_ICON = "${env:SystemRoot}\Installer\${Script:WAU_GUID}\icon.ico"
14081399

14091400
# Show the GUI
14101401
Show-WAUSettingsGUI

Sources/Winget-AutoUpdate/config/icon.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)