add quick.ps1 to gitignore

run formatter on files
This commit is contained in:
onyx-and-iris 2022-06-25 15:20:36 +01:00
parent 4417075330
commit 8429fed8b4
12 changed files with 122 additions and 122 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
# quick test
quick.ps1
lib/*.psd1
**/*.log

View File

@ -203,7 +203,7 @@ The following methods are available:
- pause
- record
- ff
- rw
- rew
The following properties accept boolean values.

View File

@ -11,14 +11,13 @@ class Remote {
[Object]$profiles
# Constructor
Remote ([String]$kind)
{
Remote ([String]$kind) {
$this.kind = $kind
$this.Setup()
}
[void] Setup() {
if(Setup_DLL) {
if (Setup_DLL) {
Login -KIND $this.kind
$this.profiles = Get_Profiles

View File

@ -13,13 +13,13 @@ Function Setup_DLL {
try {
$vb_path = Get_VBPath
if([string]::IsNullOrWhiteSpace($vb_path)) {
if ([string]::IsNullOrWhiteSpace($vb_path)) {
throw [VMRemoteErrors]::new("ERROR: Couldn't get Voicemeeter path")
}
else {
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
(&{If([Environment]::Is64BitOperatingSystem) {"64"} Else {""}}) + `
".dll")
(& { If ([Environment]::Is64BitOperatingSystem) { "64" } Else { "" } }) + `
".dll")
}
}
catch [VMRemoteErrors] {
@ -27,7 +27,7 @@ Function Setup_DLL {
return $false
}
$Signature = @"
$Signature = @"
[DllImport(@"$dll")]
public static extern int VBVMR_Login();
[DllImport(@"$dll")]
@ -66,16 +66,16 @@ $Signature = @"
Function Param_Get {
param(
[String]$PARAM, [bool]$IS_STRING=$false
[String]$PARAM, [bool]$IS_STRING = $false
)
Start-Sleep -m 50
while(P_Dirty) { Start-Sleep -m 1 }
while (P_Dirty) { Start-Sleep -m 1 }
if($IS_STRING) {
if ($IS_STRING) {
$BYTES = [System.Byte[]]::new(512)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterStringA($PARAM, $BYTES)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@ -86,7 +86,7 @@ Function Param_Get {
New-Variable -Name ptr -Value 0.0
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterFloat($PARAM, [ref]$ptr)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@ -100,13 +100,13 @@ Function Param_Set {
[String]$PARAM, [Object]$VALUE
)
try {
if($VALUE -is [String]) {
if ($VALUE -is [String]) {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterStringA($PARAM, $VALUE)
}
else {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterFloat($PARAM, $VALUE)
}
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@ -119,7 +119,7 @@ Function MB_Set {
)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_SetStatus($ID, $SET, $MODE)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@ -131,12 +131,12 @@ Function MB_Get {
[Int64]$ID, [Int64]$MODE
)
Start-Sleep -m 50
while(M_Dirty) { Start-Sleep -m 1 }
while (M_Dirty) { Start-Sleep -m 1 }
New-Variable -Name ptr -Value 0.0
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_GetStatus($ID, [ref]$ptr, $MODE)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@ -150,17 +150,17 @@ Function Param_Set_Multi {
)
ForEach ($key in $HASH.keys) {
$classobj , $m2, $m3 = $key.Split("_")
if ($m2 -match "^\d+$") {$index = [int]$m2} else {$index = [int]$m3}
if ($m2 -match "^\d+$") { $index = [int]$m2 } else { $index = [int]$m3 }
ForEach ($h in $HASH[$key].GetEnumerator()) {
$property = $h.Name
$value = $h.Value
if ($value -in ('False', 'True')) { [System.Convert]::ToBoolean($value) }
Switch($classobj) {
Switch ($classobj) {
'strip' { $this.strip[$index].$property = $value }
'bus' { $this.bus[$index].$property = $value }
{($_ -eq 'button') -or ($_ -eq 'mb')} { $this.button[$index].$property = $value }
{ ($_ -eq 'button') -or ($_ -eq 'mb') } { $this.button[$index].$property = $value }
'vban' { $this.vban.$m2[$index].$property = $value }
}
}
@ -173,36 +173,36 @@ Function DefineVersion {
)
$layout = @{}
if($TYPE -eq 1) {
if ($TYPE -eq 1) {
$layout = @{
"name" = "basic"
"p_in" = 2
"v_in" = 1
"p_out" = 1
"v_out" = 1
"vban_in" = 4
"name" = "basic"
"p_in" = 2
"v_in" = 1
"p_out" = 1
"v_out" = 1
"vban_in" = 4
"vban_out" = 4
}
}
elseif($TYPE -eq 2) {
elseif ($TYPE -eq 2) {
$layout = @{
"name" = "banana"
"p_in" = 3
"v_in" = 2
"p_out" = 3
"v_out" = 2
"vban_in" = 8
"name" = "banana"
"p_in" = 3
"v_in" = 2
"p_out" = 3
"v_out" = 2
"vban_in" = 8
"vban_out" = 8
}
}
elseif($TYPE -eq 3) {
elseif ($TYPE -eq 3) {
$layout = @{
"name" = "potato"
"p_in" = 5
"v_in" = 3
"p_out" = 5
"v_out" = 3
"vban_in" = 8
"name" = "potato"
"p_in" = 5
"v_in" = 3
"p_out" = 5
"v_out" = 3
"vban_in" = 8
"vban_out" = 8
}
}
@ -213,10 +213,11 @@ Function Get_Profiles {
$basepath = Join-Path -Path $(Split-Path -Path $PSScriptRoot) -ChildPath "profiles"
if (Test-Path $basepath) {
$fullpath = Join-Path -Path $basepath -ChildPath $layout.name
} else {return $null}
}
else { return $null }
$filenames = @(Get-ChildItem -Path $fullpath -Filter *.psd1 -Recurse -File)
if($filenames) {
if ($filenames) {
[System.Collections.ArrayList]$configfiles = @()
$filenames | ForEach-Object {
$file = (Join-Path -Path $fullpath -ChildPath $_)
@ -239,7 +240,7 @@ Function Set_Profile {
[Object]$DATA, [String]$CONF
)
try {
if($null -eq $DATA -or -not $DATA.$CONF) {
if ($null -eq $DATA -or -not $DATA.$CONF) {
throw [VMRemoteErrors]::new("No profile named $CONF was loaded")
}
Param_Set_Multi -HASH $DATA.$CONF
@ -252,47 +253,50 @@ Function Set_Profile {
Function Login {
param(
[String]$KIND=$null
[String]$KIND = $null
)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_Login()
if(-not $retval) { Write-Host("LOGGED IN") }
elseif($retval -eq 1) {
if (-not $retval) { Write-Host("LOGGED IN") }
elseif ($retval -eq 1) {
Write-Host("VM NOT RUNNING")
New-Variable -Name vm_exe -Value 0
Switch($KIND) {
'basic' { $vm_exe = 1; Break}
'banana' { $vm_exe = 2; Break}
Switch ($KIND) {
'basic' { $vm_exe = 1; Break }
'banana' { $vm_exe = 2; Break }
'potato' {
if ([Environment]::Is64BitOperatingSystem) {
$vm_exe = 6
} else { $vm_exe = 3 }
$vm_exe = 6
}
else { $vm_exe = 3 }
Break
}
Default { throw [LoginError]::new('Unknown Voicemeeter type') }
}
$retval = [Int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([Int64]$vm_exe)
if(-not $retval) { Write-Host("STARTING VOICEMEETER") }
if (-not $retval) { Write-Host("STARTING VOICEMEETER") }
else { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
Start-Sleep -s 1
} elseif ($retval -eq -2) {
}
elseif ($retval -eq -2) {
throw [LoginError]::new('Login may only be called once per session')
} else { Exit }
}
else { Exit }
}
catch [LoginError], [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
}
while(P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
New-Variable -Name ptr -Value 0
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterType([ref]$ptr)
if(-not $retval) {
if($ptr -eq 1) { Write-Host("VERSION:[BASIC]") }
elseif($ptr -eq 2) { Write-Host("VERSION:[BANANA]") }
elseif($ptr -eq 3) { Write-Host("VERSION:[POTATO]") }
if (-not $retval) {
if ($ptr -eq 1) { Write-Host("VERSION:[BASIC]") }
elseif ($ptr -eq 2) { Write-Host("VERSION:[BANANA]") }
elseif ($ptr -eq 3) { Write-Host("VERSION:[POTATO]") }
}
DefineVersion -TYPE $ptr
@ -301,7 +305,7 @@ Function Login {
Function Logout {
Start-Sleep -m 20
$retval = [Int][Voicemeeter.Remote]::VBVMR_Logout()
if(-not $retval) { Write-Host("LOGGED OUT") }
if (-not $retval) { Write-Host("LOGGED OUT") }
}
Function P_Dirty {

View File

@ -4,8 +4,7 @@ class Bus {
[Int]$id
# Constructor
Bus ([Int]$id)
{
Bus ([Int]$id) {
$this.id = $id
AddBoolMembers -PARAMS @('mono', 'mute')
@ -13,7 +12,7 @@ class Bus {
AddFloatMembers -PARAMS @('gain')
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21',
'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
}
[Single] Getter($cmd) {
@ -61,7 +60,7 @@ class PhysicalBus : Bus {
$this.Getter_String($this.cmd('device.name'))
}`
{
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only")
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only")
}
)
@ -70,7 +69,7 @@ class PhysicalBus : Bus {
$this.Getter($this.cmd('device.sr'))
}`
{
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only")
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only")
}
)
}
@ -82,7 +81,7 @@ class VirtualBus : Bus {
Function Make_Buses {
[System.Collections.ArrayList]$bus = @()
0..$($layout.p_out + $layout.v_out -1) | ForEach-Object {
0..$($layout.p_out + $layout.v_out - 1) | ForEach-Object {
if ($_ -lt $layout.p_out) { [void]$bus.Add([PhysicalBus]::new($_)) }
else { [void]$bus.Add([VirtualBus]::new($_)) }
}

View File

@ -2,8 +2,7 @@
class Special {
# Constructor
Special()
{
Special() {
AddActionMembers -PARAMS @('restart', 'shutdown', 'show')
}
@ -13,7 +12,7 @@ class Special {
[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

View File

@ -1,7 +1,7 @@
Function Get_VBPath {
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + `
(&{If([Environment]::Is64BitOperatingSystem) {"\WOW6432Node"} Else {""}}) + `
"\Microsoft\Windows\CurrentVersion\Uninstall"
(& { If ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } Else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall"
$vm_key = "\VB:Voicemeeter {17359A74-1236-5467}\"
return $(Get-ItemPropertyValue -Path ($reg_path + $vm_key) -Name UninstallString | Split-Path -Parent)

View File

@ -2,8 +2,7 @@ class MacroButton {
[int32]$id
# Constructor
MacroButton ([Int]$id)
{
MacroButton ([Int]$id) {
$this.id = $id
}

View File

@ -3,12 +3,12 @@ Function AddBoolMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('{0}'))" -f $param
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
-f $param
-f $param
Addmember
}
@ -19,12 +19,12 @@ Function AddFloatMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[math]::Round(`$this.Getter(`$this.cmd('{0}')), 1)" -f $param
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
-f $param
-f $param
Addmember
}
@ -35,12 +35,12 @@ Function AddIntMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[Int]`$this.Getter(`$this.cmd('{0}'))" -f $param
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
-f $param
-f $param
Addmember
}
@ -51,12 +51,12 @@ Function AddStringMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[String]`$this.Getter_String(`$this.cmd('{0}'))" -f $param
# Define setter
$Signatures["Setter"] = "param ( [String]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
-f $param
-f $param
Addmember
}
@ -67,7 +67,7 @@ Function AddActionMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "`$this.Setter(`$this.cmd('{0}'), `$true)" -f $param
# Define setter
@ -83,7 +83,7 @@ Function AddChannelMembers() {
[System.Collections.ArrayList]$channels = @()
1..$($num_A + $num_B) | ForEach-Object {
if($_ -le $num_A) {$channels.Add("A{0}" -f $_)} else {$channels.Add("B{0}" -f $($_ - $num_A))}
if ($_ -le $num_A) { $channels.Add("A{0}" -f $_) } else { $channels.Add("B{0}" -f $($_ - $num_A)) }
}
AddBoolMembers -PARAMS $channels
@ -96,7 +96,7 @@ Function AddGainlayerMembers() {
$Signatures["Getter"] = "`$this.Getter(`$this.cmd('gainlayer[{0}]'))" -f $_
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('gainlayer[{0}]'), `$arg)" `
-f $_
-f $_
$param = "gainlayer{0}" -f $_
Addmember
@ -108,23 +108,23 @@ Function AddBusModeMembers() {
[String[]]$PARAMS
)
[HashTable]$Signatures = @{}
ForEach($param in $PARAMS) {
ForEach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('mode.{0}'))" -f $param
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('mode.{0}'), `$arg)" `
-f $param
-f $param
$param = "mode_{0}" -f $param
Addmember
}
}
Function Addmember{
Function Addmember {
$AddMemberParams = @{
Name = $param
MemberType = 'ScriptProperty'
Value = [ScriptBlock]::Create($Signatures["Getter"])
Name = $param
MemberType = 'ScriptProperty'
Value = [ScriptBlock]::Create($Signatures["Getter"])
SecondValue = [ScriptBlock]::Create($Signatures["Setter"])
}
$this | Add-Member @AddMemberParams

View File

@ -2,9 +2,8 @@
class Recorder {
# Constructor
Recorder()
{
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rw')
Recorder() {
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
AddChannelMembers
}
@ -14,7 +13,7 @@ class Recorder {
[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
@ -27,7 +26,7 @@ class Recorder {
hidden $_loop = $($this | Add-Member ScriptProperty 'loop' `
{
return Write-Warning("ERROR: " + $this.cmd('mode.loop') + " is write only")
return Write-Warning("ERROR: " + $this.cmd('mode.loop') + " is write only")
}`
{
param( [bool]$arg )

View File

@ -3,8 +3,7 @@
class Strip {
[Int]$id
Strip ([Int]$id)
{
Strip ([Int]$id) {
$this.id = $id
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
@ -43,7 +42,7 @@ class PhysicalStrip : Strip {
$this.Getter_String($this.cmd('device.name'))
}`
{
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only")
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only")
}
)
@ -52,7 +51,7 @@ class PhysicalStrip : Strip {
$this.Getter($this.cmd('device.sr'))
}`
{
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only")
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only")
}
)
}

View File

@ -3,8 +3,7 @@ class Vban {
[String]$direction
# Constructor
Vban($id)
{
Vban($id) {
$this.id = $id
}
@ -60,7 +59,7 @@ class Vban {
}`
{
param ( [String]$arg )
if($arg -In 1024..65535) {
if ($arg -In 1024..65535) {
$this._port = $this.Setter($this.cmd('port'), $arg)
}
else {
@ -75,10 +74,10 @@ class Vban {
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
if ($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
$opts = @(11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
if($opts.Contains($arg)) {
if ($opts.Contains($arg)) {
$this._port = $this.Setter($this.cmd('sr'), $arg)
}
else {
@ -94,9 +93,9 @@ class Vban {
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
if ($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 1..8) {
if ($arg -In 1..8) {
$this._channel = $this.Setter($this.cmd('channel'), $arg)
}
else {
@ -108,15 +107,15 @@ class Vban {
hidden $_bit = $($this | Add-Member ScriptProperty 'bit' `
{
$val = if($this.Getter($this.cmd('bit')) -eq 1) {16} else {24}
$val = if ($this.Getter($this.cmd('bit')) -eq 1) { 16 } else { 24 }
return $val
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
if ($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if(@(16,24).Contains($arg)) {
$val = if($arg -eq 16) {1} else {2}
if (@(16, 24).Contains($arg)) {
$val = if ($arg -eq 16) { 1 } else { 2 }
$this._bit = $this.Setter($this.cmd('bit'), $val)
}
else {
@ -132,9 +131,9 @@ class Vban {
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
if ($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 0..4) {
if ($arg -In 0..4) {
$this._quality = $this.Setter($this.cmd('quality'), $arg)
}
else {
@ -150,9 +149,9 @@ class Vban {
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
if ($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 0..8) {
if ($arg -In 0..8) {
$this._route = $this.Setter($this.cmd('route'), $arg)
}
else {
@ -166,7 +165,7 @@ class Vban {
class VbanInstream : Vban {
# Constructor
VbanInstream ([int]$id) : base ($id){
VbanInstream ([int]$id) : base ($id) {
$this.direction = "in"
}
}
@ -174,7 +173,7 @@ class VbanInstream : Vban {
class VbanOutstream : Vban {
# Constructor
VbanOutstream ([int]$id) : base ($id){
VbanOutstream ([int]$id) : base ($id) {
$this.direction = "out"
}
}
@ -184,15 +183,15 @@ Function Make_Vban {
[System.Collections.ArrayList]$instream = @()
[System.Collections.ArrayList]$outstream = @()
0..$($layout.vban_in-1) | ForEach-Object {
0..$($layout.vban_in - 1) | ForEach-Object {
[void]$instream.Add([VbanInstream]::new($_))
}
0..$($layout.vban_out-1) | ForEach-Object {
0..$($layout.vban_out - 1) | ForEach-Object {
[void]$outstream.Add([VbanOutstream]::new($_))
}
$CustomObject = [PSCustomObject]@{
instream = $instream
instream = $instream
outstream = $outstream
}
@ -202,7 +201,7 @@ Function Make_Vban {
}`
{
param( [bool]$arg )
Param_Set -PARAM 'vban.Enable' -VALUE $(if ($arg) {1} else {0})
Param_Set -PARAM 'vban.Enable' -VALUE $(if ($arg) { 1 } else { 0 })
}
$CustomObject