add regex to base, remove tests from modules

Parse multi set params using regex

Remove tests from each module
This commit is contained in:
Onyx and Iris 2021-05-02 13:34:13 +01:00
parent 2f1508e8f1
commit 63a56c7a72
4 changed files with 5 additions and 71 deletions

View File

@ -51,13 +51,10 @@ Function Param_Set_Multi {
[string[]]$params = ($HASH | out-string -stream) -ne '' | Select-Object -Skip 2
[String]$cmd = [String]::new(512)
ForEach ($line in $params) {
$line = $($line -replace '\s+', ' ')
$line = $line.TrimEnd()
$line = $line -replace '\s', '='
$line = $line -replace 'True', '1'
$line = $line -replace 'False', '0'
$cmd += $line + ';'
if($line.Trim() -Match "(^\w+)\[(\d)\].(\w+)\s+(\w+)") {
if($Matches[4] -eq "True") { $val = [String]1 } else { $val = [String]0 }
$cmd += "$($Matches[1])[$($Matches[2])].$($Matches[3])=$val;"
}
}
[String]$cmd = $cmd.SubString(1)
@ -212,7 +209,7 @@ Function Login {
'basic' { $vbtype = 1; Break}
'banana' { $vbtype = 2; Break}
'potato' { $vbtype = 3; Break}
Default { throw [LoginError]::new('Unknown Voicemeeter type') }
Default { throw [LoginError]::new('Unknown Voicemeeter type') }
}
$retval = [Int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([Int64]$vbtype)
@ -254,13 +251,3 @@ Function P_Dirty {
Function M_Dirty {
[Bool][Voicemeeter.Remote]::VBVMR_MacroButton_IsDirty()
}
if ($MyInvocation.InvocationName -ne '.')
{
Login
Param_Set -PARAM 'garbagevalue' -Value $true
Logout
}

View File

@ -57,22 +57,3 @@ Function Buses {
}
$bus
}
if ($MyInvocation.InvocationName -ne '.')
{
. .\voicemeeter.ps1
try {
$vmr = [Remote]::new('potato')
$vmr.bus[0].mono = $true
$vmr.bus[0].mono
$vmr.bus[0].mono = $false
$vmr.bus[0].mono
$vmr.bus[1].gain = 3.2
$vmr.bus[1].gain
$vmr.bus[2].gain = -2.0
$vmr.bus[2].gain
}
finally { $vmr.Logout() }
}

View File

@ -59,17 +59,3 @@ Function Buttons {
}
$button
}
if ($MyInvocation.InvocationName -ne '.')
{
. .\voicemeeter.ps1
try {
$vmr = [Remote]::new('potato')
$vmr.button[0].state = $true
$vmr.button[0].state
$vmr.button[0].state = $false
$vmr.button[0].state
}
finally { $vmr.Logout() }
}

View File

@ -177,23 +177,3 @@ Function Strips {
}
$strip
}
if ($MyInvocation.InvocationName -ne '.')
{
. .\voicemeeter.ps1
try {
$vmr = [Remote]::new('potato')
$vmr.strip[1].A1 = $true
$vmr.strip[1].A1
$vmr.strip[2].A2 = $false
$vmr.strip[2].A2
$vmr.strip[1].gain = 3.2
$vmr.strip[1].gain
$vmr.strip[2].gain = -2.0
$vmr.strip[2].gain
}
finally { $vmr.Logout() }
}