add undoscript feature + implement it on every tweaks (#776)

* add undoscript feature + implement it on right click menu

- add undoscript feature
- add undo for right click menu to go back to windows 11 default right click menu by implementing undoscript feature

* undoscript for WPFMiscTweaksDisplay

* undoscript for WPFEssTweaksRemoveEdge

* undoscript for WPFEssTweaksRemoveCortana

* undoscript for WPFEssTweaksStorage

* Update Invoke-WinUtilTweaks.ps1

thanks to @DeveloperDurp

* compile
This commit is contained in:
Padsala Tushal
2023-05-31 08:49:36 +05:30
committed by GitHub
parent 907a383d48
commit b82ba886e6
3 changed files with 73 additions and 27 deletions

View File

@ -15,19 +15,16 @@ function Invoke-WinUtilTweaks {
Registry = "OriginalValue"
ScheduledTask = "OriginalState"
Service = "OriginalType"
ScriptType = "UndoScript"
}
}
Else{
$Values = @{
Registry = "Value"
ScheduledTask = "State"
Service = "StartupType"
}
}
if($sync.configs.tweaks.$CheckBox.registry){
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
ScriptType = "InvokeScript"
}
}
if($sync.configs.tweaks.$CheckBox.ScheduledTask){
@ -40,6 +37,17 @@ function Invoke-WinUtilTweaks {
Set-WinUtilService -Name $psitem.Name -StartupType $psitem.$($values.Service)
}
}
if($sync.configs.tweaks.$CheckBox.registry){
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
}
}
if($sync.configs.tweaks.$CheckBox.$($values.ScriptType)){
$sync.configs.tweaks.$CheckBox.$($values.ScriptType) | ForEach-Object {
$Scriptblock = [scriptblock]::Create($psitem)
Invoke-WinUtilScript -ScriptBlock $scriptblock -Name $CheckBox
}
}
if(!$undo){
if($sync.configs.tweaks.$CheckBox.appx){
@ -47,11 +55,6 @@ function Invoke-WinUtilTweaks {
Remove-WinUtilAPPX -Name $psitem
}
}
if($sync.configs.tweaks.$CheckBox.InvokeScript){
$sync.configs.tweaks.$CheckBox.InvokeScript | ForEach-Object {
$Scriptblock = [scriptblock]::Create($psitem)
Invoke-WinUtilScript -ScriptBlock $scriptblock -Name $CheckBox
}
}
}
}
}