mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-15 07:05:51 -06:00
3903eaaa24
* Replace Tabs with Spaces to follow the conventions
* Add Preprocessing in Compiler
* Compile from Anywhere you want - Running 'Compile.ps1' Works in any directory you call it from
* Code Formatting Changes
* Result of Preprocessing Step in 'Compile.ps1' Script - Remove Trailing Whitespace Characters
* Make Preprocessing more advanced
* Move Preprocessing to a separate script file
* Make Self Modification impossible for 'tools/Do-PreProcessing.ps1' Script - Make the workingdir same as sync.PSScriptRoot for consistency
* Revert commit b5dffd671f
* Patched a Bug of some Excluded Files not actually get excluded in 'Get-ChildItem' PS Cmdlet
* Update Replace Regex for Code Formatting in 'Do-PreProcessing' Script Tool
* Rename 'Do-PreProcessing' to 'Invoke-Preprocessing' - Update some Comments
* Make 'Invoke-Preprocessing' Modular - Update RegEx to handle more cases - Update Documentation - Add Validations & Useful feedback upon error
* Replace Tabs with Spaces to follow the conventions - 'applications.json' File
* Code Formatting Changes - 'Copy-Files' Private Function
* Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool
* Replace Tabs with Spaces to follow the conventions - Make 'ExcludedFiles' validation step check all filepaths before finally checking if any has failed
* Result of 'Invoke-Preprocessing' Script
* Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool
58 lines
1.6 KiB
PowerShell
58 lines
1.6 KiB
PowerShell
function Invoke-WPFPresets {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Sets the options in the tweaks panel to the given preset
|
|
|
|
.PARAMETER preset
|
|
The preset to set the options to
|
|
|
|
.PARAMETER imported
|
|
If the preset is imported from a file, defaults to false
|
|
|
|
.PARAMETER checkbox
|
|
The checkbox to set the options to, defaults to 'WPFTweaks'
|
|
|
|
#>
|
|
|
|
param(
|
|
$preset,
|
|
[bool]$imported = $false
|
|
)
|
|
|
|
if($imported -eq $true) {
|
|
$CheckBoxesToCheck = $preset
|
|
} else {
|
|
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
|
}
|
|
|
|
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" }
|
|
Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)"
|
|
|
|
$CheckBoxesToCheck | ForEach-Object {
|
|
if ($_ -ne $null) {
|
|
Write-Debug $_
|
|
}
|
|
}
|
|
|
|
foreach ($CheckBox in $CheckBoxes) {
|
|
$checkboxName = $CheckBox.Key
|
|
|
|
if (-not $CheckBoxesToCheck) {
|
|
$sync.$checkboxName.IsChecked = $false
|
|
continue
|
|
}
|
|
|
|
# Check if the checkbox name exists in the flattened JSON hashtable
|
|
if ($CheckBoxesToCheck.Contains($checkboxName)) {
|
|
# If it exists, set IsChecked to true
|
|
$sync.$checkboxName.IsChecked = $true
|
|
Write-Debug "$checkboxName is checked"
|
|
} else {
|
|
# If it doesn't exist, set IsChecked to false
|
|
$sync.$checkboxName.IsChecked = $false
|
|
Write-Debug "$checkboxName is not checked"
|
|
}
|
|
}
|
|
}
|