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

@ -9,6 +9,18 @@ Before any minor/major patch is released all test units will be run to verify th
## [Unreleased] ## [Unreleased]
- [x] - [x]
## [1.8] - 2021-08-23
### Added
- Added special commands
### Changed
- Add special section to README
### Fixed
- Removed unneeded console output
## [1.6] - 2021-06-06 ## [1.6] - 2021-06-06
### Added ### Added
- Add vban commands - Add vban commands

View File

@ -145,6 +145,15 @@ $vmr.vban_in[2].port = 6990
$vmr.vban_out[3].bit = 16 $vmr.vban_out[3].bit = 16
``` ```
### Special
Certain 'special' commands are defined by the API as performing actions rather than setting values. You may invoke them with the following commands:
```powershell
$vmr.command.show
$vmr.command.restart
$vmr.command.showvbanchat
$vmr.command.shutdown
```
### Run tests ### Run tests
Run tests using .\runall.ps1 which accepts two parameters: Run tests using .\runall.ps1 which accepts two parameters:
- tag Run tests of this type - tag Run tests of this type

10
examples/special.ps1 Normal file
View File

@ -0,0 +1,10 @@
Import-Module Voicemeeter
try {
$vmr = Get-RemoteBanana
$vmr.command.show
$vmr.command.restart
$vmr.command.showvbanchat
}
finally { $vmr.Logout() }

View File

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

View File

@ -4,6 +4,7 @@
. $PSScriptRoot\bus.ps1 . $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1 . $PSScriptRoot\macrobuttons.ps1
. $PSScriptRoot\vban.ps1 . $PSScriptRoot\vban.ps1
. $PSScriptRoot\special.ps1
$global:layout = $null $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()
}