mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-16 00:40:39 +00:00
* Add startup performance tracing * Lazy initialize non-default tabs * Render install app entries incrementally * Defer and cache toggle status checks * Clean up runspace invocation ownership * Defer GUI runspace pool startup * Defer status taskbar asset rendering * Record final speed verification * Fix deferred install render timer callback * Add dispatcher smoke coverage for install rendering * Replace install render timer with dispatcher callbacks * Gate performance tracing behind compile switch * Clean up analyzer warnings in speed changes * Speed up runspace and tab initialization
41 lines
1.1 KiB
PowerShell
41 lines
1.1 KiB
PowerShell
Function Get-WinUtilToggleStatus ($ToggleSwitch) {
|
|
|
|
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
|
|
|
if ($null -eq $sync.ToggleStatusCache) {
|
|
$sync.ToggleStatusCache = @{}
|
|
}
|
|
|
|
if ($sync.ToggleStatusCache.ContainsKey($ToggleSwitch)) {
|
|
return [bool]$sync.ToggleStatusCache[$ToggleSwitch]
|
|
}
|
|
|
|
if (-not (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
|
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null
|
|
}
|
|
|
|
foreach ($regentry in $ToggleSwitchReg) {
|
|
|
|
if (Test-Path $regentry.Path) {
|
|
$regstate = (Get-ItemProperty -Path $regentry.Path).$($regentry.Name)
|
|
} else {
|
|
$regstate = $null
|
|
}
|
|
|
|
if ($null -eq $regstate) {
|
|
switch ([string]$regentry.DefaultState) {
|
|
"true" { $regstate = $regentry.Value }
|
|
"false" { $regstate = $regentry.OriginalValue }
|
|
}
|
|
}
|
|
|
|
if ($regstate -ne $regentry.Value) {
|
|
$sync.ToggleStatusCache[$ToggleSwitch] = $false
|
|
return $false
|
|
}
|
|
}
|
|
|
|
$sync.ToggleStatusCache[$ToggleSwitch] = $true
|
|
return $true
|
|
}
|