rework assets directory & its usage

This commit is contained in:
MyDrift
2024-07-15 12:08:58 +02:00
parent e7e742044b
commit c490cbff1a
3 changed files with 27 additions and 17 deletions

View File

@ -430,22 +430,33 @@ $sync["SearchBar"].Add_TextChanged({
$label.Visibility = "Collapsed"}
})
$cttpnglogo = "$env:LOCALAPPDATA\winutil\cttlogo.png"
$ctticologo = "$env:LOCALAPPDATA\winutil\cttlogo.ico"
if (-NOT (Test-Path -Path $cttpnglogo) -or -NOT (Test-Path -Path $ctticologo)) {
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $cttpnglogo
}
# Initialize the hashtable
$winutildir = @{}
$cttpngcheckmark = "$env:LOCALAPPDATA\winutil\cttcheckmark.png"
$ctticocheckmark = "$env:LOCALAPPDATA\winutil\cttcheckmark.ico"
if (-NOT (Test-Path -Path $cttpngcheckmark) -or -NOT (Test-Path -Path $ctticocheckmark)) {
Invoke-WebRequest -Uri "https://christitus.com/images/checkmark.png" -OutFile $cttpngcheckmark
# Set the path for the winutil directory
$winutildir["path"] = "$env:LOCALAPPDATA\winutil"
if (-NOT (Test-Path -Path $winutildir["path"])) {
New-Item -Path $winutildir["path"] -ItemType Directory
}
ConvertTo-Icon -bitmapPath $cttpnglogo -iconPath $ctticologo
# Set the path for the logo and checkmark images
$winutildir["logo.png"] = "$env:LOCALAPPDATA\winutil\cttlogo.png"
$winutildir["logo.ico"] = "$env:LOCALAPPDATA\winutil\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"]
}
$winutildir["checkmark.png"] = "$env:LOCALAPPDATA\winutil\cttcheckmark.png"
if (-NOT (Test-Path -Path $winutildir["checkmark.png"])) {
Invoke-WebRequest -Uri "https://christitus.com/images/checkmark.png" -OutFile $winutildir["checkmark.png"]
}
Set-WinUtilTaskbaritem -overlay "logo" | Out-Null
$sync["Form"].icon = $cttpnglogo
$sync["Form"].icon = $winutildir["logo.png"]
$sync["Form"].Add_Activated({
Set-WinUtilTaskbaritem -overlay "logo"