mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-02-17 16:06:59 +00:00
Refactor code structure for improved readability and maintainability (#473)
* Add ToolTips to Tweaks
This commit is contained in:
26
Scripts/FileIO/SaveSettings.ps1
Normal file
26
Scripts/FileIO/SaveSettings.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Saves the current settings, excluding control parameters, to 'LastUsedSettings.json' file
|
||||
function SaveSettings {
|
||||
$settings = @{
|
||||
"Version" = "1.0"
|
||||
"Settings" = @()
|
||||
}
|
||||
|
||||
foreach ($param in $script:Params.Keys) {
|
||||
if ($script:ControlParams -notcontains $param) {
|
||||
$value = $script:Params[$param]
|
||||
|
||||
$settings.Settings += @{
|
||||
"Name" = $param
|
||||
"Value" = $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$settings | ConvertTo-Json -Depth 10 | Set-Content $script:SavedSettingsFilePath
|
||||
}
|
||||
catch {
|
||||
Write-Output ""
|
||||
Write-Host "Error: Failed to save settings to LastUsedSettings.json file" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user