hotfix for new commit

This commit is contained in:
MyDrift 2024-07-17 07:37:56 +02:00
parent 2fab47dd13
commit b8416c1f96

View File

@ -43,24 +43,24 @@ Function Install-WinUtilProgramWinget {
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode $status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
if($status -eq 0) { if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully." Write-Host "$($Program.winget) installed successfully."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
if ($status -eq -1978335189) { if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found" Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
Write-Host "Attempt with User scope" Write-Host "Attempt with User scope"
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode $status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
if($status -eq 0) { if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully with User scope." Write-Host "$($Program.winget) installed successfully with User scope."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
if ($status -eq -1978335189) { if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found" Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
Write-Host "Attempt with User prompt" Write-Host "Attempt with User prompt"
@ -75,18 +75,18 @@ Function Install-WinUtilProgramWinget {
} }
if($status -eq 0) { if($status -eq 0) {
Write-Host "$($Program.winget) installed successfully with User prompt." Write-Host "$($Program.winget) installed successfully with User prompt."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
if ($status -eq -1978335189) { if ($status -eq -1978335189) {
Write-Host "$($Program.winget) No applicable update found" Write-Host "$($Program.winget) No applicable update found"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
continue continue
} }
} catch { } catch {
Write-Host "Failed to install $($Program.winget). With winget" Write-Host "Failed to install $($Program.winget). With winget"
$failedPackages += $Program $failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
} }
} }
elseif($manage -eq "Uninstalling") { elseif($manage -eq "Uninstalling") {
@ -95,6 +95,7 @@ Function Install-WinUtilProgramWinget {
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode $status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
if($status -ne 0) { if($status -ne 0) {
Write-Host "Failed to uninstall $($Program.winget)." Write-Host "Failed to uninstall $($Program.winget)."
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
} else { } else {
Write-Host "$($Program.winget) uninstalled successfully." Write-Host "$($Program.winget) uninstalled successfully."
$failedPackages += $Program $failedPackages += $Program
@ -104,7 +105,7 @@ Function Install-WinUtilProgramWinget {
$failedPackages += $Program $failedPackages += $Program
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
} }
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$count) }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
} }
else { else {
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage" throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"