mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 13:20:47 +00:00
update base, inst
refactor get dll and exe path
This commit is contained in:
parent
0e756871e1
commit
acbc2c52cc
12
lib/base.ps1
12
lib/base.ps1
@ -16,12 +16,9 @@ Function Setup_DLL {
|
|||||||
throw [VBPathError]::new("ERROR: Couldn't get Voicemeeter path")
|
throw [VBPathError]::new("ERROR: Couldn't get Voicemeeter path")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if([Environment]::Is64BitOperatingSystem) {
|
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
|
||||||
$dll = Join-Path -Path $vb_path -ChildPath "VoicemeeterRemote64.dll"
|
(&{If([Environment]::Is64BitOperatingSystem) {"64"} Else {""}}) + `
|
||||||
}
|
".dll")
|
||||||
else {
|
|
||||||
$dll = Join-Path -Path $vb_path -ChildPath "VoicemeeterRemote.dll"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch [VBPathError] {
|
catch [VBPathError] {
|
||||||
@ -29,6 +26,9 @@ Function Setup_DLL {
|
|||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$Signature = @"
|
$Signature = @"
|
||||||
[DllImport(@"$dll")]
|
[DllImport(@"$dll")]
|
||||||
public static extern int VBVMR_Login();
|
public static extern int VBVMR_Login();
|
||||||
|
19
lib/inst.ps1
19
lib/inst.ps1
@ -1,15 +1,8 @@
|
|||||||
Function Get_VBPath {
|
Function Get_VBPath {
|
||||||
@(
|
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + `
|
||||||
'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall',
|
(&{If([Environment]::Is64BitOperatingSystem) {"\WOW6432Node"} Else {""}}) + `
|
||||||
'Registry::HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
|
"\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||||
) | ForEach-Object {
|
$vm_key = "\VB:Voicemeeter {17359A74-1236-5467}\"
|
||||||
if(Test-Path -Path $_) {
|
|
||||||
(Get-ChildItem -Path $_\*) | ForEach-Object {
|
return $(Get-ItemPropertyValue -Path ($reg_path + $vm_key) -Name UninstallString | Split-Path -Parent)
|
||||||
if($_.Name.Contains("Voicemeeter")) {
|
|
||||||
$reg = -join("Registry::", $_.Name)
|
|
||||||
return $(Get-ItemPropertyValue -Path $reg -Name UninstallString | Split-Path -Parent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user