mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
* Improve O&O ShutUp10++ download flow * Refine Windows Update profile behavior and docs * Fix documentation link regressions * Restore updates when applying recommended profile
51 lines
2.0 KiB
PowerShell
51 lines
2.0 KiB
PowerShell
function Invoke-WPFOOSU {
|
|
if ($sync.ProcessRunning) {
|
|
Show-WinUtilMessage -Message "Another process is currently running." -Title "WinUtil" -Button "OK" -Icon "Warning"
|
|
return
|
|
}
|
|
|
|
$downloadPath = Join-Path $sync.winutildir "ooshutup10.exe"
|
|
$sync.ProcessRunning = $true
|
|
|
|
Invoke-WPFRunspace -ParameterList @(,("downloadPath", $downloadPath)) -ScriptBlock {
|
|
param($downloadPath)
|
|
|
|
$hasUI = $null -ne $sync.Form -and $null -ne $sync.Form.Dispatcher
|
|
|
|
try {
|
|
Write-WinUtilLog -Component "OOSU" -Message "Downloading O&O ShutUp10++."
|
|
if ($hasUI) {
|
|
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Downloading O&O ShutUp10++ (0%)" -Percent 0
|
|
}
|
|
|
|
Save-WinUtilFile -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -DestinationPath $downloadPath -ProgressCallback {
|
|
param($percent)
|
|
|
|
if ($hasUI) {
|
|
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Downloading O&O ShutUp10++ ($percent%)" -Percent $percent
|
|
}
|
|
}
|
|
|
|
if ($hasUI) {
|
|
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Launching O&O ShutUp10++" -Percent 100
|
|
}
|
|
Start-Process -FilePath $downloadPath
|
|
|
|
Write-WinUtilLog -Component "OOSU" -Message "O&O ShutUp10++ launched."
|
|
if ($hasUI) {
|
|
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "O&O ShutUp10++ launched" -Percent 100
|
|
}
|
|
}
|
|
catch {
|
|
Write-WinUtilLog -Level "ERROR" -Component "OOSU" -Message "O&O ShutUp10++ download failed: $($_.Exception.Message)"
|
|
if ($hasUI) {
|
|
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "O&O ShutUp10++ download failed" -Percent 100
|
|
}
|
|
Write-Error "Couldn't download O&O ShutUp10. Please make sure you have an active Internet connection."
|
|
}
|
|
finally {
|
|
$sync.ProcessRunning = $false
|
|
}
|
|
}
|
|
}
|