mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-12-05 05:07:47 +00:00
create iremote.ps1
This commit is contained in:
parent
bd0779add2
commit
2404bfb50f
@ -2,6 +2,7 @@
|
|||||||
. $PSScriptRoot\meta.ps1
|
. $PSScriptRoot\meta.ps1
|
||||||
. $PSScriptRoot\base.ps1
|
. $PSScriptRoot\base.ps1
|
||||||
. $PSScriptRoot\kinds.ps1
|
. $PSScriptRoot\kinds.ps1
|
||||||
|
. $PSScriptRoot\iremote.ps1
|
||||||
. $PSScriptRoot\strip.ps1
|
. $PSScriptRoot\strip.ps1
|
||||||
. $PSScriptRoot\bus.ps1
|
. $PSScriptRoot\bus.ps1
|
||||||
. $PSScriptRoot\macrobuttons.ps1
|
. $PSScriptRoot\macrobuttons.ps1
|
||||||
|
|||||||
49
lib/iremote.ps1
Normal file
49
lib/iremote.ps1
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
class IRemote {
|
||||||
|
[int]$index
|
||||||
|
[Object]$remote
|
||||||
|
|
||||||
|
IRemote ([Object]$remote) {
|
||||||
|
$this.remote = $remote
|
||||||
|
}
|
||||||
|
|
||||||
|
IRemote ([int]$index, [Object]$remote) {
|
||||||
|
$this.index = $index
|
||||||
|
$this.remote = $remote
|
||||||
|
}
|
||||||
|
|
||||||
|
[single] Getter ($param) {
|
||||||
|
$this.ToString() + " Getter: $($this.Cmd($param))" | Write-Debug
|
||||||
|
return $this.remote.Getter($this.Cmd($param))
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] Getter_String ($param) {
|
||||||
|
$this.ToString() + " Getter_String: $($this.Cmd($param))" | Write-Debug
|
||||||
|
return $this.remote.Getter_String($this.Cmd($param))
|
||||||
|
}
|
||||||
|
|
||||||
|
[void] Setter ($param, $val) {
|
||||||
|
$this.ToString() + " Setter: $($this.Cmd($param))=$val" | Write-Debug
|
||||||
|
if ($val -is [Boolean]) {
|
||||||
|
$this.remote.Setter($this.Cmd($param), $(if ($val) { 1 } else { 0 }))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this.remote.Setter($this.Cmd($param), $val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] Cmd ($param) {
|
||||||
|
if ([string]::IsNullOrEmpty($param)) {
|
||||||
|
return $this.identifier()
|
||||||
|
}
|
||||||
|
return "$($this.identifier()).$param"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Must be overridden by derived classes
|
||||||
|
[string] identifier () {
|
||||||
|
throw [System.NotImplementedException]::new("$($this.GetType().Name) must override identifier()")
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] ToString() {
|
||||||
|
return $this.GetType().Name
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user