mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
Fix Theming
This commit is contained in:
parent
14d20cd161
commit
9abe11c975
@ -27,19 +27,19 @@
|
|||||||
"MicroWinLogoSize": "10",
|
"MicroWinLogoSize": "10",
|
||||||
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#FFAC1C",
|
"ProgressBarForegroundColor": "#2e77ff",
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
"ProgressBarBackgroundColor": "Transparent",
|
||||||
"ProgressBarTextColor": "#000000",
|
"ProgressBarTextColor": "#232629",
|
||||||
|
|
||||||
"ComboBoxBackgroundColor": "#FFFFFF",
|
"ComboBoxBackgroundColor": "#F7F7F7",
|
||||||
"LabelboxForegroundColor": "#000000",
|
"LabelboxForegroundColor": "#232629",
|
||||||
"MainForegroundColor": "#000000",
|
"MainForegroundColor": "#232629",
|
||||||
"MainBackgroundColor": "#FFFFFF",
|
"MainBackgroundColor": "#F7F7F7",
|
||||||
"LabelBackgroundColor": "#FFFFFF",
|
"LabelBackgroundColor": "#F7F7F7",
|
||||||
"LinkForegroundColor": "#000000",
|
"LinkForegroundColor": "#232629",
|
||||||
"LinkHoverForegroundColor": "#000000",
|
"LinkHoverForegroundColor": "#232629",
|
||||||
"GroupBorderBackgroundColor": "#000000",
|
"GroupBorderBackgroundColor": "#232629",
|
||||||
"ComboBoxForegroundColor": "#000000",
|
"ComboBoxForegroundColor": "#232629",
|
||||||
|
|
||||||
"ButtonFontSize": "12",
|
"ButtonFontSize": "12",
|
||||||
"ButtonFontFamily": "Arial",
|
"ButtonFontFamily": "Arial",
|
||||||
@ -52,65 +52,65 @@
|
|||||||
"SearchBarTextBoxFontSize": "12",
|
"SearchBarTextBoxFontSize": "12",
|
||||||
"SearchBarClearButtonFontSize": "14",
|
"SearchBarClearButtonFontSize": "14",
|
||||||
|
|
||||||
"ButtonInstallBackgroundColor": "#FFFFFF",
|
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||||
"ButtonTweaksBackgroundColor": "#FFFFFF",
|
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||||
"ButtonConfigBackgroundColor": "#FFFFFF",
|
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||||
"ButtonUpdatesBackgroundColor": "#FFFFFF",
|
"ButtonUpdatesBackgroundColor": "#F7F7F7",
|
||||||
"ButtonInstallForegroundColor": "#000000",
|
"ButtonInstallForegroundColor": "#232629",
|
||||||
"ButtonTweaksForegroundColor": "#000000",
|
"ButtonTweaksForegroundColor": "#232629",
|
||||||
"ButtonConfigForegroundColor": "#000000",
|
"ButtonConfigForegroundColor": "#232629",
|
||||||
"ButtonUpdatesForegroundColor": "#000000",
|
"ButtonUpdatesForegroundColor": "#232629",
|
||||||
"ButtonBackgroundColor": "#F5F5F5",
|
"ButtonBackgroundColor": "#F5F5F5",
|
||||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||||
"CheckboxMouseOverColor": "#999999",
|
"CheckboxMouseOverColor": "#999999",
|
||||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||||
"ButtonForegroundColor": "#000000",
|
"ButtonForegroundColor": "#232629",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
|
||||||
"ButtonBorderThickness": "1",
|
"ButtonBorderThickness": "1",
|
||||||
"ButtonMargin": "1",
|
"ButtonMargin": "1",
|
||||||
"ButtonCornerRadius": "2",
|
"ButtonCornerRadius": "2",
|
||||||
"BorderColor": "#000000",
|
"BorderColor": "#232629",
|
||||||
"BorderOpacity": "0.2",
|
"BorderOpacity": "0.2",
|
||||||
"ShadowPulse": "Forever"
|
"ShadowPulse": "Forever"
|
||||||
},
|
},
|
||||||
"Classic": {
|
"Classic": {
|
||||||
"ComboBoxBackgroundColor": "#FFFFFF",
|
"ComboBoxBackgroundColor": "#F7F7F7",
|
||||||
"LabelboxForegroundColor": "#000000",
|
"LabelboxForegroundColor": "#232629",
|
||||||
"MainForegroundColor": "#000000",
|
"MainForegroundColor": "#232629",
|
||||||
"MainBackgroundColor": "#FFFFFF",
|
"MainBackgroundColor": "#F7F7F7",
|
||||||
"LabelBackgroundColor": "#FFFFFF",
|
"LabelBackgroundColor": "#F7F7F7",
|
||||||
"LinkForegroundColor": "#000000",
|
"LinkForegroundColor": "#232629",
|
||||||
"LinkHoverForegroundColor": "#000000",
|
"LinkHoverForegroundColor": "#232629",
|
||||||
"GroupBorderBackgroundColor": "#000000",
|
"GroupBorderBackgroundColor": "#232629",
|
||||||
"ComboBoxForegroundColor": "#000000",
|
"ComboBoxForegroundColor": "#232629",
|
||||||
|
|
||||||
"ButtonInstallBackgroundColor": "#FFFFFF",
|
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||||
"ButtonTweaksBackgroundColor": "#FFFFFF",
|
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||||
"ButtonConfigBackgroundColor": "#FFFFFF",
|
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||||
"ButtonUpdatesBackgroundColor": "#FFFFFF",
|
"ButtonUpdatesBackgroundColor": "#F7F7F7",
|
||||||
"ButtonInstallForegroundColor": "#000000",
|
"ButtonInstallForegroundColor": "#232629",
|
||||||
"ButtonTweaksForegroundColor": "#000000",
|
"ButtonTweaksForegroundColor": "#232629",
|
||||||
"ButtonConfigForegroundColor": "#000000",
|
"ButtonConfigForegroundColor": "#232629",
|
||||||
"ButtonUpdatesForegroundColor": "#000000",
|
"ButtonUpdatesForegroundColor": "#232629",
|
||||||
"ButtonBackgroundColor": "#F5F5F5",
|
"ButtonBackgroundColor": "#F5F5F5",
|
||||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||||
"CheckboxMouseOverColor": "#999999",
|
"CheckboxMouseOverColor": "#999999",
|
||||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||||
"ButtonForegroundColor": "#000000",
|
"ButtonForegroundColor": "#232629",
|
||||||
"ToggleButtonOnColor": "#2e77ff"
|
"ToggleButtonOnColor": "#2e77ff"
|
||||||
},
|
},
|
||||||
"Matrix": {
|
"Matrix": {
|
||||||
"ComboBoxBackgroundColor": "#000000",
|
"ComboBoxBackgroundColor": "#232629",
|
||||||
"LabelboxForegroundColor": "#FFEE58",
|
"LabelboxForegroundColor": "#81a1c1",
|
||||||
"MainForegroundColor": "#9CCC65",
|
"MainForegroundColor": "#F7F7F7",
|
||||||
"MainBackgroundColor": "#000000",
|
"MainBackgroundColor": "#232629",
|
||||||
"LabelBackgroundColor": "#000000",
|
"LabelBackgroundColor": "#232629",
|
||||||
"LinkForegroundColor": "#add8e6",
|
"LinkForegroundColor": "#add8e6",
|
||||||
"LinkHoverForegroundColor": "#FFFFFF",
|
"LinkHoverForegroundColor": "#F7F7F7",
|
||||||
"ComboBoxForegroundColor": "#FFEE58",
|
"ComboBoxForegroundColor": "#81a1c1",
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#222222",
|
"ProgressBarForegroundColor": "#222222",
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
"ProgressBarBackgroundColor": "Transparent",
|
||||||
@ -120,30 +120,30 @@
|
|||||||
"ButtonTweaksBackgroundColor": "#333333",
|
"ButtonTweaksBackgroundColor": "#333333",
|
||||||
"ButtonConfigBackgroundColor": "#444444",
|
"ButtonConfigBackgroundColor": "#444444",
|
||||||
"ButtonUpdatesBackgroundColor": "#555555",
|
"ButtonUpdatesBackgroundColor": "#555555",
|
||||||
"ButtonInstallForegroundColor": "#FFFFFF",
|
"ButtonInstallForegroundColor": "#F7F7F7",
|
||||||
"ButtonTweaksForegroundColor": "#FFFFFF",
|
"ButtonTweaksForegroundColor": "#F7F7F7",
|
||||||
"ButtonConfigForegroundColor": "#FFFFFF",
|
"ButtonConfigForegroundColor": "#F7F7F7",
|
||||||
"ButtonUpdatesForegroundColor": "#FFFFFF",
|
"ButtonUpdatesForegroundColor": "#F7F7F7",
|
||||||
"ButtonBackgroundColor": "#000019",
|
"ButtonBackgroundColor": "#1E3747",
|
||||||
"ButtonBackgroundPressedColor": "#FFFFFF",
|
"ButtonBackgroundPressedColor": "#F7F7F7",
|
||||||
"ButtonBackgroundMouseoverColor": "#A55A64",
|
"ButtonBackgroundMouseoverColor": "#3B4252",
|
||||||
"ButtonBackgroundSelectedColor": "#FF5733",
|
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||||
"ButtonForegroundColor": "#9CCC65",
|
"ButtonForegroundColor": "#F7F7F7",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
|
||||||
"BorderColor": "#FFAC1C",
|
"BorderColor": "#0060CC",
|
||||||
"BorderOpacity": "0.8",
|
"BorderOpacity": "0.2",
|
||||||
"ShadowPulse": "0:0:3"
|
"ShadowPulse": "0:0:3"
|
||||||
},
|
},
|
||||||
"Dark": {
|
"Dark": {
|
||||||
"ComboBoxBackgroundColor": "#000000",
|
"ComboBoxBackgroundColor": "#232629",
|
||||||
"LabelboxForegroundColor": "#FFEE58",
|
"LabelboxForegroundColor": "#81a1c1",
|
||||||
"MainForegroundColor": "#9CCC65",
|
"MainForegroundColor": "#F7F7F7",
|
||||||
"MainBackgroundColor": "#000000",
|
"MainBackgroundColor": "#232629",
|
||||||
"LabelBackgroundColor": "#000000",
|
"LabelBackgroundColor": "#232629",
|
||||||
"LinkForegroundColor": "#add8e6",
|
"LinkForegroundColor": "#add8e6",
|
||||||
"LinkHoverForegroundColor": "#FFFFFF",
|
"LinkHoverForegroundColor": "#F7F7F7",
|
||||||
"ComboBoxForegroundColor": "#FFEE58",
|
"ComboBoxForegroundColor": "#81a1c1",
|
||||||
|
|
||||||
"ProgressBarForegroundColor": "#222222",
|
"ProgressBarForegroundColor": "#222222",
|
||||||
"ProgressBarBackgroundColor": "Transparent",
|
"ProgressBarBackgroundColor": "Transparent",
|
||||||
@ -153,17 +153,17 @@
|
|||||||
"ButtonTweaksBackgroundColor": "#333333",
|
"ButtonTweaksBackgroundColor": "#333333",
|
||||||
"ButtonConfigBackgroundColor": "#444444",
|
"ButtonConfigBackgroundColor": "#444444",
|
||||||
"ButtonUpdatesBackgroundColor": "#555555",
|
"ButtonUpdatesBackgroundColor": "#555555",
|
||||||
"ButtonInstallForegroundColor": "#FFFFFF",
|
"ButtonInstallForegroundColor": "#F7F7F7",
|
||||||
"ButtonTweaksForegroundColor": "#FFFFFF",
|
"ButtonTweaksForegroundColor": "#F7F7F7",
|
||||||
"ButtonConfigForegroundColor": "#FFFFFF",
|
"ButtonConfigForegroundColor": "#F7F7F7",
|
||||||
"ButtonUpdatesForegroundColor": "#FFFFFF",
|
"ButtonUpdatesForegroundColor": "#F7F7F7",
|
||||||
"ButtonBackgroundColor": "#000019",
|
"ButtonBackgroundColor": "#1E3747",
|
||||||
"ButtonBackgroundPressedColor": "#9CCC65",
|
"ButtonBackgroundPressedColor": "#00CFFF",
|
||||||
"ButtonBackgroundMouseoverColor": "#FF5733",
|
"ButtonBackgroundMouseoverColor": "#5E81AC",
|
||||||
"ButtonBackgroundSelectedColor": "#FF5733",
|
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||||
"ButtonForegroundColor": "#9CCC65",
|
"ButtonForegroundColor": "#F7F7F7",
|
||||||
"ToggleButtonOnColor": "#2e77ff",
|
"ToggleButtonOnColor": "#2e77ff",
|
||||||
|
|
||||||
"BorderColor": "#FFAC1C"
|
"BorderColor": "#0b1215"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
|
|
||||||
=== "prefer Chocolatey"
|
=== "prefer Chocolatey"
|
||||||
* Check the `prefer Chocolatey` checkbox
|
* Check the `prefer Chocolatey` checkbox
|
||||||
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
||||||
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
||||||
|
|
||||||
![Install Image](assets/Install-Tab-Dark.png#only-dark)
|
![Install Image](assets/Install-Tab-Dark.png#only-dark)
|
||||||
![Install Image](assets/Install-Tab-Light.png#only-light)
|
![Install Image](assets/Install-Tab-Light.png#only-light)
|
||||||
|
@ -28,86 +28,86 @@ function Install-WinUtilProgramChoco {
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Initializes an output file by removing any existing file and creating a new, empty file at the specified path.
|
Initializes an output file by removing any existing file and creating a new, empty file at the specified path.
|
||||||
|
|
||||||
.PARAMETER filePath
|
.PARAMETER filePath
|
||||||
The full path to the file to be initialized.
|
The full path to the file to be initialized.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function ensures that the specified file is reset by removing any existing file at the provided path and then creating a new, empty file. It is useful when preparing a log or output file for subsequent operations.
|
This function ensures that the specified file is reset by removing any existing file at the provided path and then creating a new, empty file. It is useful when preparing a log or output file for subsequent operations.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Initialize-OutputFile -filePath "C:\temp\output.txt"
|
Initialize-OutputFile -filePath "C:\temp\output.txt"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param ($filePath)
|
param ($filePath)
|
||||||
Remove-Item -Path $filePath -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $filePath -Force -ErrorAction SilentlyContinue
|
||||||
New-Item -ItemType File -Path $filePath | Out-Null
|
New-Item -ItemType File -Path $filePath | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
function Run-ChocoCommand {
|
function Run-ChocoCommand {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Executes a Chocolatey command with the specified arguments and returns the exit code.
|
Executes a Chocolatey command with the specified arguments and returns the exit code.
|
||||||
|
|
||||||
.PARAMETER arguments
|
.PARAMETER arguments
|
||||||
The arguments to be passed to the Chocolatey command.
|
The arguments to be passed to the Chocolatey command.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function runs a specified Chocolatey command by passing the provided arguments to the `choco` executable. It waits for the process to complete and then returns the exit code, allowing the caller to determine success or failure based on the exit code.
|
This function runs a specified Chocolatey command by passing the provided arguments to the `choco` executable. It waits for the process to complete and then returns the exit code, allowing the caller to determine success or failure based on the exit code.
|
||||||
|
|
||||||
.RETURNS
|
.RETURNS
|
||||||
[int]
|
[int]
|
||||||
The exit code of the Chocolatey command.
|
The exit code of the Chocolatey command.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$exitCode = Run-ChocoCommand -arguments "install 7zip -y"
|
$exitCode = Run-ChocoCommand -arguments "install 7zip -y"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param ($arguments)
|
param ($arguments)
|
||||||
return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode
|
return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
function Check-UpgradeNeeded {
|
function Check-UpgradeNeeded {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks if an upgrade is needed for a Chocolatey package based on the content of a log file.
|
Checks if an upgrade is needed for a Chocolatey package based on the content of a log file.
|
||||||
|
|
||||||
.PARAMETER filePath
|
.PARAMETER filePath
|
||||||
The path to the log file that contains the output of a Chocolatey install command.
|
The path to the log file that contains the output of a Chocolatey install command.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function reads the specified log file and checks for keywords that indicate whether an upgrade is needed. It returns a boolean value indicating whether the terms "reinstall" or "already installed" are present, which suggests that the package might need an upgrade.
|
This function reads the specified log file and checks for keywords that indicate whether an upgrade is needed. It returns a boolean value indicating whether the terms "reinstall" or "already installed" are present, which suggests that the package might need an upgrade.
|
||||||
|
|
||||||
.RETURNS
|
.RETURNS
|
||||||
[bool]
|
[bool]
|
||||||
True if the log file indicates that an upgrade is needed; otherwise, false.
|
True if the log file indicates that an upgrade is needed; otherwise, false.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$isUpgradeNeeded = Check-UpgradeNeeded -filePath "C:\temp\install-output.txt"
|
$isUpgradeNeeded = Check-UpgradeNeeded -filePath "C:\temp\install-output.txt"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param ($filePath)
|
param ($filePath)
|
||||||
return Get-Content -Path $filePath | Select-String -Pattern "reinstall|already installed" -Quiet
|
return Get-Content -Path $filePath | Select-String -Pattern "reinstall|already installed" -Quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
function Update-TaskbarProgress {
|
function Update-TaskbarProgress {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Updates the taskbar progress based on the current installation progress.
|
Updates the taskbar progress based on the current installation progress.
|
||||||
|
|
||||||
.PARAMETER currentIndex
|
.PARAMETER currentIndex
|
||||||
The current index of the program being installed or uninstalled.
|
The current index of the program being installed or uninstalled.
|
||||||
|
|
||||||
.PARAMETER totalPrograms
|
.PARAMETER totalPrograms
|
||||||
The total number of programs to be installed or uninstalled.
|
The total number of programs to be installed or uninstalled.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function calculates the progress of the installation or uninstallation process and updates the taskbar accordingly. The taskbar is set to "Normal" if all programs have been processed, otherwise, it is set to "Error" as a placeholder.
|
This function calculates the progress of the installation or uninstallation process and updates the taskbar accordingly. The taskbar is set to "Normal" if all programs have been processed, otherwise, it is set to "Error" as a placeholder.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Update-TaskbarProgress -currentIndex 3 -totalPrograms 10
|
Update-TaskbarProgress -currentIndex 3 -totalPrograms 10
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[int]$currentIndex,
|
[int]$currentIndex,
|
||||||
[int]$totalPrograms
|
[int]$totalPrograms
|
||||||
@ -115,43 +115,43 @@ function Install-WinUtilProgramChoco {
|
|||||||
$progressState = if ($currentIndex -eq $totalPrograms) { "Normal" } else { "Error" }
|
$progressState = if ($currentIndex -eq $totalPrograms) { "Normal" } else { "Error" }
|
||||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state $progressState -value ($currentIndex / $totalPrograms) })
|
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state $progressState -value ($currentIndex / $totalPrograms) })
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-ChocoPackage {
|
function Install-ChocoPackage {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs a Chocolatey package and optionally upgrades it if needed.
|
Installs a Chocolatey package and optionally upgrades it if needed.
|
||||||
|
|
||||||
.PARAMETER Program
|
.PARAMETER Program
|
||||||
A string containing the name of the Chocolatey package to be installed.
|
A string containing the name of the Chocolatey package to be installed.
|
||||||
|
|
||||||
.PARAMETER currentIndex
|
.PARAMETER currentIndex
|
||||||
The current index of the program in the list of programs to be managed.
|
The current index of the program in the list of programs to be managed.
|
||||||
|
|
||||||
.PARAMETER totalPrograms
|
.PARAMETER totalPrograms
|
||||||
The total number of programs to be installed.
|
The total number of programs to be installed.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function installs a Chocolatey package by running the `choco install` command. If the installation output indicates that an upgrade might be needed, the function will attempt to upgrade the package. The taskbar progress is updated after each package is processed.
|
This function installs a Chocolatey package by running the `choco install` command. If the installation output indicates that an upgrade might be needed, the function will attempt to upgrade the package. The taskbar progress is updated after each package is processed.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Install-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
Install-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[string]$Program,
|
[string]$Program,
|
||||||
[int]$currentIndex,
|
[int]$currentIndex,
|
||||||
[int]$totalPrograms
|
[int]$totalPrograms
|
||||||
)
|
)
|
||||||
|
|
||||||
$installOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt"
|
$installOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt"
|
||||||
Initialize-OutputFile $installOutputFile
|
Initialize-OutputFile $installOutputFile
|
||||||
|
|
||||||
Write-Host "Starting installation of $Program with Chocolatey."
|
Write-Host "Starting installation of $Program with Chocolatey."
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$installStatusCode = Run-ChocoCommand "install $Program -y --log-file $installOutputFile"
|
$installStatusCode = Run-ChocoCommand "install $Program -y --log-file $installOutputFile"
|
||||||
if ($installStatusCode -eq 0) {
|
if ($installStatusCode -eq 0) {
|
||||||
|
|
||||||
if (Check-UpgradeNeeded $installOutputFile) {
|
if (Check-UpgradeNeeded $installOutputFile) {
|
||||||
$upgradeStatusCode = Run-ChocoCommand "upgrade $Program -y"
|
$upgradeStatusCode = Run-ChocoCommand "upgrade $Program -y"
|
||||||
Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." })
|
Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." })
|
||||||
@ -171,37 +171,37 @@ function Install-WinUtilProgramChoco {
|
|||||||
Update-TaskbarProgress $currentIndex $totalPrograms
|
Update-TaskbarProgress $currentIndex $totalPrograms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Uninstall-ChocoPackage {
|
function Uninstall-ChocoPackage {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Uninstalls a Chocolatey package and any related metapackages.
|
Uninstalls a Chocolatey package and any related metapackages.
|
||||||
|
|
||||||
.PARAMETER Program
|
.PARAMETER Program
|
||||||
A string containing the name of the Chocolatey package to be uninstalled.
|
A string containing the name of the Chocolatey package to be uninstalled.
|
||||||
|
|
||||||
.PARAMETER currentIndex
|
.PARAMETER currentIndex
|
||||||
The current index of the program in the list of programs to be managed.
|
The current index of the program in the list of programs to be managed.
|
||||||
|
|
||||||
.PARAMETER totalPrograms
|
.PARAMETER totalPrograms
|
||||||
The total number of programs to be uninstalled.
|
The total number of programs to be uninstalled.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function uninstalls a Chocolatey package and any related metapackages (e.g., .install or .portable variants). It updates the taskbar progress after processing each package.
|
This function uninstalls a Chocolatey package and any related metapackages (e.g., .install or .portable variants). It updates the taskbar progress after processing each package.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Uninstall-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
Uninstall-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[string]$Program,
|
[string]$Program,
|
||||||
[int]$currentIndex,
|
[int]$currentIndex,
|
||||||
[int]$totalPrograms
|
[int]$totalPrograms
|
||||||
)
|
)
|
||||||
|
|
||||||
$uninstallOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt"
|
$uninstallOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt"
|
||||||
Initialize-OutputFile $uninstallOutputFile
|
Initialize-OutputFile $uninstallOutputFile
|
||||||
|
|
||||||
Write-Host "Searching for metapackages of $Program (.install or .portable)"
|
Write-Host "Searching for metapackages of $Program (.install or .portable)"
|
||||||
$chocoPackages = ((choco list | Select-String -Pattern "$Program(\.install|\.portable)?").Matches.Value) -join " "
|
$chocoPackages = ((choco list | Select-String -Pattern "$Program(\.install|\.portable)?").Matches.Value) -join " "
|
||||||
if ($chocoPackages) {
|
if ($chocoPackages) {
|
||||||
|
@ -60,7 +60,7 @@ function Invoke-WPFInstall {
|
|||||||
if($packagesWinget.Count -gt 0) {
|
if($packagesWinget.Count -gt 0) {
|
||||||
Install-WinUtilWinget
|
Install-WinUtilWinget
|
||||||
Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget
|
Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget
|
||||||
|
|
||||||
}
|
}
|
||||||
if($packagesChoco.Count -gt 0) {
|
if($packagesChoco.Count -gt 0) {
|
||||||
Install-WinUtilChoco
|
Install-WinUtilChoco
|
||||||
|
@ -217,7 +217,7 @@
|
|||||||
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundMouseoverColor}"/>
|
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundMouseoverColor}"/>
|
||||||
<Setter Property="Effect">
|
<Setter Property="Effect">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<DropShadowEffect Opacity="1" ShadowDepth="5" Color="Gold" Direction="-100" BlurRadius="45"/>
|
<DropShadowEffect Opacity="1" ShadowDepth="5" Color="{ButtonBackgroundMouseoverColor}" Direction="-100" BlurRadius="15"/>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="Panel.ZIndex" Value="2000"/>
|
<Setter Property="Panel.ZIndex" Value="2000"/>
|
||||||
@ -228,7 +228,7 @@
|
|||||||
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundSelectedColor}"/>
|
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundSelectedColor}"/>
|
||||||
<Setter Property="Effect">
|
<Setter Property="Effect">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<DropShadowEffect Opacity="1" ShadowDepth="2" Color="Gold" Direction="-111" BlurRadius="25"/>
|
<DropShadowEffect Opacity="1" ShadowDepth="2" Color="{ButtonBackgroundMouseoverColor}" Direction="-111" BlurRadius="10"/>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
Loading…
Reference in New Issue
Block a user