mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-12 02:51:16 +10:00
Make MPO tweak a three-state control (#4897)
* refactor: make MPO tweak a three-state control * docs: explain MPO tweak states * docs: address code review comments * refactor: make Multiplane Overlay config-driven
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
function Get-WinUtilRegistryComboValue {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Reads one registry value for a registry-backed combo-box state.
|
||||
|
||||
.PARAMETER Setting
|
||||
The registry setting from the combo-box configuration.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
$Setting
|
||||
)
|
||||
|
||||
try {
|
||||
$item = Get-ItemProperty -Path $Setting.Path -Name $Setting.Name -ErrorAction Stop
|
||||
$property = $item.PSObject.Properties[$Setting.Name]
|
||||
return [pscustomobject]@{ Exists = $null -ne $property; Value = $property.Value }
|
||||
} catch [System.Management.Automation.PSArgumentException] {
|
||||
# The registry provider uses PSArgumentException when a named value is absent.
|
||||
return [pscustomobject]@{ Exists = $false; Value = $null }
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
return [pscustomobject]@{ Exists = $false; Value = $null }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user