Deleted Test-WinUtilPackageManager.ps1 + custom winget and choco installs + remove winget/choco enums and exeptions (#4606)

* Update Invoke-WPFGetInstalled.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Delete functions/private/Test-WinUtilPackageManager.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Invoke-WPFGetInstalled.ps1

* Update Invoke-WPFGetInstalled.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Fixed lastrun.json

* refactor: remove PackageManagers enum and unused custom exception classes

* Update Invoke-WPFUIElements.ps1

* Update Get-WinUtilSelectedPackages.ps1

* Update Set-Preferences.ps1

* Update main.ps1

* Complete package manager enum removal

Use string package-manager preferences throughout the remaining helpers and focused tests. Restore the existing Winget install flow and package-manager probe helper so PR 4606 keeps the current WinGet repair method.

* Fix string keyed package split

---------

Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
Gabi
2026-07-02 12:50:57 -05:00
committed by GitHub
co-authored by Chris Titus
parent d45c62e470
commit 727ba52a4d
11 changed files with 52 additions and 124 deletions
@@ -4,7 +4,7 @@ function Get-WinUtilPackageLogSummary {
[object[]]$Packages,
[Parameter(Mandatory = $true)]
[PackageManagers]$Preference
[string]$Preference
)
@($Packages | ForEach-Object {
@@ -17,7 +17,7 @@ function Get-WinUtilPackageLogSummary {
$packageName = "Unknown package"
}
if ($Preference -eq [PackageManagers]::Choco -and -not [string]::IsNullOrWhiteSpace([string]$package.choco) -and $package.choco -ne "na") {
if ($Preference -eq "Choco" -and -not [string]::IsNullOrWhiteSpace([string]$package.choco) -and $package.choco -ne "na") {
"$packageName (choco: $($package.choco))"
} elseif (-not [string]::IsNullOrWhiteSpace([string]$package.winget) -and $package.winget -ne "na") {
"$packageName (winget: $($package.winget))"
@@ -5,7 +5,7 @@ function Get-WinUtilSelectedPackages {
[object] $PackageList,
[Parameter(Mandatory = $true)]
[PackageManagers] $Preference
[string] $Preference
)
if ($PackageList.count -eq 1) {
@@ -17,8 +17,8 @@ function Get-WinUtilSelectedPackages {
$packagesWinget = [System.Collections.ArrayList]::new()
$packagesChoco = [System.Collections.ArrayList]::new()
$packages = @{
([PackageManagers]::Winget) = $packagesWinget
([PackageManagers]::Choco) = $packagesChoco
Winget = $packagesWinget
Choco = $packagesChoco
}
function Add-PackageId {
+4 -13
View File
@@ -1,16 +1,7 @@
function Install-WinUtilChoco {
<#
.SYNOPSIS
Installs Chocolatey if it is not already installed
#>
if ((Test-WinUtilPackageManager -choco) -eq "installed") {
return
if (-not (Get-Command -Name choco)) {
Write-Host "Chocolatey is not installed. Installing now..."
$installScript = Invoke-WebRequest -Uri https://community.chocolatey.org/install.ps1 -UseBasicParsing
Invoke-Command -ScriptBlock ([scriptblock]::Create($installScript.Content))
}
Write-Host "Chocolatey is not installed. Installing now..."
$installScript = Invoke-WebRequest -Uri https://community.chocolatey.org/install.ps1 -UseBasicParsing
Invoke-Command -ScriptBlock ([scriptblock]::Create($installScript.Content))
}
-8
View File
@@ -60,14 +60,6 @@ function Set-Preferences{
if ($null -eq $sync.preferences.packagemanager) {
$sync.preferences.packagemanager = "Winget"
}
# convert packagemanager to enum
if ($sync.preferences.packagemanager -eq "Choco") {
$sync.preferences.packagemanager = [PackageManagers]::Choco
}
elseif ($sync.preferences.packagemanager -eq "Winget") {
$sync.preferences.packagemanager = [PackageManagers]::Winget
}
}
$iniPath = "$winutildir\preferences.ini"