Compare commits

...

2 Commits

3 changed files with 25 additions and 7 deletions

View File

@ -17,27 +17,34 @@ Function Get-WinUtilToggleStatus {
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
$null = New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
write-host "Created HKU drive"
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
Write-Host "HKU drive created successfully" -ForegroundColor Green
} else {
Write-Host "Failed to create HKU drive"
}
}
if ($ToggleSwitchReg) {
$count = 0
foreach ($regentry in $ToggleSwitchReg) {
$regstate = (Get-ItemProperty -path $($regentry.Path)).$($regentry.Name)
write-host "Checking $($regentry.path)"
$regstate = (Get-ItemProperty -path $regentry.Path).$($regentry.Name)
if ($regstate -eq $regentry.Value) {
$count += 1
write-host "$($regentry.Name) is true (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))" -ForegroundColor Green
} else {
write-debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
write-host "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
}
}
if ($count -eq $ToggleSwitchReg.Count) {
write-debug "$($ToggleSwitchReg.Name) is true (count: $count)"
write-host "$($ToggleSwitchReg.Name) is true (count: $count)" -ForegroundColor Green
return $true
} else {
write-debug "$($ToggleSwitchReg.Name) is false (count: $count)"
write-host "$($ToggleSwitchReg.Name) is false (count: $count)"
return $false
}
} else {

View File

@ -77,9 +77,14 @@ function Invoke-WinUtilTweaks {
if($sync.configs.tweaks.$CheckBox.registry) {
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
Write-Debug "$($psitem.Name) and state is $($psitem.$($values.registry))"
if (($psitem.Path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
write-host "Created HKU drive"
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
Write-Host "HKU drive created successfully"
} else {
Write-Host "Failed to create HKU drive"
}
}
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
}

View File

@ -192,7 +192,13 @@ function Invoke-WPFUIElements {
$sync[$entryInfo.Name] = $checkBox
$sync[$entryInfo.Name].IsChecked = Get-WinUtilToggleStatus $entryInfo.Name
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
if ($sync[$entryInfo.Name].IsChecked) {
write-host "$($entryInfo.Name) is checked" -ForegroundColor Blue
} else {
write-host "$($entryInfo.Name) is not checked" -ForegroundColor Red
}
$sync[$entryInfo.Name].Add_Checked({
[System.Object]$Sender = $args[0]