mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 13:20:47 +00:00
62c65e1c08
GetType, GetVersion, SendText added to Remote class. Console output now written to Debug stream. ToString() method overriden for higher classes. formatter run through all files.
38 lines
1.2 KiB
PowerShell
38 lines
1.2 KiB
PowerShell
function Get_Profiles ([string]$kind_id) {
|
|
$basepath = Join-Path -Path $(Split-Path -Path $PSScriptRoot) -ChildPath "profiles"
|
|
if (Test-Path $basepath) {
|
|
$fullpath = Join-Path -Path $basepath -ChildPath $kind_id
|
|
}
|
|
else { return $null }
|
|
$filenames = @(Get-ChildItem -Path $fullpath -Filter *.psd1 -Recurse -File)
|
|
|
|
[hashtable]$data = @{}
|
|
if ($filenames) {
|
|
$filenames | ForEach-Object {
|
|
(Join-Path -Path $fullpath -ChildPath $_) | ForEach-Object {
|
|
$filename = [System.IO.Path]::GetFileNameWithoutExtension($_)
|
|
Write-Host ("Importing profile " + $kind_id + "/" + $filename)
|
|
$data[$filename] = Import-PowerShellDataFile -Path $_
|
|
}
|
|
}
|
|
return $data
|
|
}
|
|
return $null
|
|
}
|
|
|
|
function Set_Profile {
|
|
param(
|
|
[Object]$DATA, [string]$CONF
|
|
)
|
|
try {
|
|
if ($null -eq $DATA -or -not $DATA.$CONF) {
|
|
throw [VMRemoteErrors]::new("No profile named $CONF was loaded")
|
|
}
|
|
Param_Set_Multi -HASH $DATA.$CONF
|
|
Start-Sleep -m 1
|
|
}
|
|
catch [VMRemoteErrors] {
|
|
Write-Warning $_.Exception.ErrorMessage()
|
|
}
|
|
}
|