mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-03-20 17:09:10 +00:00
clean up IODevice.driver
'none' -> '' early return if name is empty
This commit is contained in:
parent
8d267078ff
commit
6b2031de99
@ -120,6 +120,8 @@ class IODevice : IRemote {
|
|||||||
|
|
||||||
hidden $_driver = $($this | Add-Member ScriptProperty 'driver' `
|
hidden $_driver = $($this | Add-Member ScriptProperty 'driver' `
|
||||||
{
|
{
|
||||||
|
if ([string]::IsNullOrEmpty($this.name)) { return '' }
|
||||||
|
|
||||||
$path = $this.remote.workingconfig
|
$path = $this.remote.workingconfig
|
||||||
$oldTime = if (Test-Path $path) { (Get-Item $path).LastWriteTime } else { [DateTime]::MinValue }
|
$oldTime = if (Test-Path $path) { (Get-Item $path).LastWriteTime } else { [DateTime]::MinValue }
|
||||||
|
|
||||||
@ -142,14 +144,11 @@ class IODevice : IRemote {
|
|||||||
Start-Sleep -Milliseconds 20
|
Start-Sleep -Milliseconds 20
|
||||||
} while ($sw.elapsed -lt $timeout)
|
} while ($sw.elapsed -lt $timeout)
|
||||||
|
|
||||||
if (-not $line) { return 'unknown' }
|
|
||||||
|
|
||||||
$type = $null
|
$type = $null
|
||||||
if ($line.ToString() -match "type='(?<type>\d+)'") {
|
if ($line -and $line.ToString() -match "type='(?<type>\d+)'") {
|
||||||
$type = $matches['type']
|
$type = $matches['type']
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -eq $type) { return 'none' }
|
|
||||||
if ($type -notin $this.drivers.Keys) { return 'unknown' }
|
if ($type -notin $this.drivers.Keys) { return 'unknown' }
|
||||||
return $this.drivers[$type]
|
return $this.drivers[$type]
|
||||||
} `
|
} `
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user