cosmo-vpn-windows/run-test.ps1

13 lines
1,000 B
PowerShell

param([switch]$Fresh)
# Restart the Debug build (only our own process, matched by path) and optionally reset its config.
$out = 'C:\dev\cosmo-vpn-windows\src\v2rayN\v2rayN\bin\Debug\net10.0-windows10.0.19041.0'
Get-Process v2rayN, xray -ErrorAction SilentlyContinue | Where-Object { $_.Path -like "$out*" } | Stop-Process -Force
Start-Sleep 2
if ($Fresh) { Remove-Item "$out\guiConfigs" -Recurse -Force -ErrorAction SilentlyContinue }
New-Item -ItemType Directory -Force "$out\bin\xray" | Out-Null
Copy-Item C:\dev\cosmo-vpn-windows\cores\xray\xray.exe, C:\dev\cosmo-vpn-windows\cores\xray\wintun.dll "$out\bin\xray\" -Force
Copy-Item C:\dev\cosmo-vpn-windows\cores\xray\geoip.dat, C:\dev\cosmo-vpn-windows\cores\xray\geosite.dat "$out\bin\" -Force
$env:DOTNET_ROOT = 'C:\dev\tools\dotnet' # Debug build is framework-dependent (portable SDK)
Start-Process "$out\v2rayN.exe"
Start-Sleep 10
"started: $((Get-Process v2rayN -ErrorAction SilentlyContinue | Where-Object { $_.Path -like "$out*" }).Id)"