26 lines
1011 B
PowerShell
26 lines
1011 B
PowerShell
[CmdletBinding()]
|
|
param()
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$secretPath = Join-Path $env:LOCALAPPDATA "DataTerminalVoiceDevice\server-device-secret"
|
|
$executablePath = Join-Path $PSScriptRoot "voice-device-simulator-0.1.0-windows-x64.exe"
|
|
|
|
if (-not (Test-Path -LiteralPath $secretPath -PathType Leaf)) {
|
|
throw "Cloud device credential is missing: $secretPath"
|
|
}
|
|
if (-not (Test-Path -LiteralPath $executablePath -PathType Leaf)) {
|
|
throw "Voice device simulator is missing: $executablePath"
|
|
}
|
|
|
|
$env:SIMULATOR_DEFAULT_API_URL = "https://121.41.46.238"
|
|
$env:SIMULATOR_DEFAULT_DEVICE_ID = "10000000-0000-0000-0000-000000000511"
|
|
$env:SIMULATOR_DEFAULT_DEVICE_SECRET = [IO.File]::ReadAllText($secretPath).Trim()
|
|
try {
|
|
Start-Process -FilePath $executablePath
|
|
}
|
|
finally {
|
|
Remove-Item Env:SIMULATOR_DEFAULT_API_URL -ErrorAction SilentlyContinue
|
|
Remove-Item Env:SIMULATOR_DEFAULT_DEVICE_ID -ErrorAction SilentlyContinue
|
|
Remove-Item Env:SIMULATOR_DEFAULT_DEVICE_SECRET -ErrorAction SilentlyContinue
|
|
}
|