Update command.ps1

add hide member

refactor setter
This commit is contained in:
onyx-and-iris 2022-03-08 23:03:35 +00:00
parent 9a42fadd09
commit 10c326a2f5

View File

@ -4,21 +4,33 @@ class Special {
# Constructor # Constructor
Special() Special()
{ {
AddCommandMembers -PARAMS @('restart', 'shutdown', 'show') AddActionMembers -PARAMS @('restart', 'shutdown', 'show')
} }
[String] Getter($param) { [Single] Getter($cmd) {
return Write-Warning("ERROR: Usage: $param") return Param_Get -PARAM $cmd -IS_STRING $false
} }
[void] Setter($param, $val = $true) { [void] Setter($param, $val) {
if ($val -is [Boolean]) {
Param_Set -PARAM $param -VALUE $(if ($val) {1} else {0}) Param_Set -PARAM $param -VALUE $(if ($val) {1} else {0})
} }
else {
Param_Set -PARAM $param -VALUE $val
}
}
[String] cmd ($arg) { [String] cmd ($arg) {
return "Command.$arg" return "Command.$arg"
} }
hidden $_hide = $($this | Add-Member ScriptProperty 'hide' `
{
$this._hide = $this.Setter($this.cmd('show'), $false)
}`
{}
)
hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' ` hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' `
{ {
$this.Getter($this.cmd('DialogShow.VBANCHAT')) $this.Getter($this.cmd('DialogShow.VBANCHAT'))