add special commands

Added special commands:
show
restart
showvbanchat
shutdown

Updated README and CHANGELOG to reflect changes.

Minor version bump
This commit is contained in:
onyx-and-iris
2021-08-23 15:24:05 +01:00
parent da9a71188c
commit a7913f8934
6 changed files with 83 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ class Remote {
[System.Collections.ArrayList]$bus
[System.Collections.ArrayList]$vban_in
[System.Collections.ArrayList]$vban_out
$command
# Constructor
Remote ([String]$type)
@@ -24,6 +25,7 @@ class Remote {
$this.bus = Buses
$this.vban_in = Vban_In
$this.vban_out = Vban_Out
$this.command = Special
}
else { Exit }
}

View File

@@ -4,6 +4,7 @@
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1
. $PSScriptRoot\vban.ps1
. $PSScriptRoot\special.ps1
$global:layout = $null

49
lib/special.ps1 Normal file
View File

@@ -0,0 +1,49 @@
class Special {
hidden AddPublicMembers($commands) {
$commands | ForEach-Object {
# Define getter
# $GetterSignature = "`$this.Getter(`$this.cmd('{0}'))" -f $_
# Define setter
$SetterSignature = "`$this.Setter(`$this.cmd('{0}'))" -f $_
$AddMemberParams = @{
Name = $_
MemberType = 'ScriptProperty'
Value = [ScriptBlock]::Create($SetterSignature)
SecondValue = [ScriptBlock]::Create($SetterSignature)
}
$this | Add-Member @AddMemberParams
}
}
# Constructor
Special()
{
$this.AddPublicMembers(@('restart', 'shutdown', 'show'))
}
[String] Getter($param) {
return Write-Warning("ERROR: " + $param + " is a write only parameter")
}
[void] Setter($param) {
Param_Set -PARAM $param -VALUE 1
}
[String] cmd ($arg) {
return "Command.$arg"
}
hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' `
{
$this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'))
}`
{
$this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'))
}
)
}
Function Special {
return [Special]::new()
}