voicemeeter-api-powershell/lib/command.ps1

64 lines
1.5 KiB
PowerShell
Raw Normal View History

. $PSScriptRoot\meta.ps1
class Special {
Special () {
AddActionMembers -PARAMS @('restart', 'shutdown', 'show')
}
2022-12-16 17:27:05 +00:00
[string] identifier () {
return "Command"
}
[string] ToString() {
return $this.GetType().Name
}
2022-12-16 17:27:05 +00:00
[single] Getter ($param) {
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
}
[void] Setter ($param, $val) {
if ($val -is [Boolean]) {
2022-12-16 17:27:05 +00:00
Param_Set -PARAM "$($this.identifier()).$param" -Value $(if ($val) { 1 } else { 0 })
}
else {
2022-12-16 17:27:05 +00:00
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
}
}
hidden $_hide = $($this | Add-Member ScriptProperty 'hide' `
{
2022-12-16 17:27:05 +00:00
$this._hide = $this.Setter('show', $false)
} `
{}
)
hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' `
{
2022-12-16 17:27:05 +00:00
$this.Getter('DialogShow.VBANCHAT')
} `
{
param([bool]$arg)
2022-12-16 17:27:05 +00:00
$this._showvbanchat = $this.Setter('DialogShow.VBANCHAT', $arg)
}
)
hidden $_lock = $($this | Add-Member ScriptProperty 'lock' `
{
2022-12-16 17:27:05 +00:00
$this._lock = $this.Getter('lock')
} `
{
param([bool]$arg)
2022-12-16 17:27:05 +00:00
$this._lock = $this.Setter('lock', $arg)
}
)
[void] Load ([string]$filename) {
2022-12-16 17:27:05 +00:00
$this.Setter('load', $filename)
}
}
function Make_Command {
return [Special]::new()
}