mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-18 13:33:31 +00:00
general updates, added fadeto/fadeby
fadeto, fadeby added to strip|bus kind maps reworked. bindings/profiles/kinds moved into their own files. changelog/readme updated version bump
This commit is contained in:
37
lib/profiles.ps1
Normal file
37
lib/profiles.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user