Created
February 22, 2014 05:06
-
-
Save snapcase/9149018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param | |
( | |
[Parameter(Mandatory=$false)] | |
[ValidatePattern("qlive://[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]{5}/\S+")] | |
[string]$uri | |
) | |
$log_file = "$Env:TMP\quakelive_launcher.log" | |
if (Test-Path $log_file) { | |
$path, $arg = Select-String -Path $log_file -CaseSensitive -Pattern "^(?:Engine path|Launch parameters): (.*)" | | |
%{ $_.Matches[0].Groups[1].Value } | |
} else { | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
[System.Windows.Forms.MessageBox]::Show("log missing, use Launcher and try again") | |
exit | |
} | |
if ($uri) { | |
$arg += $uri -replace 'qlive://([^/]*)/(.*)', '+wait 500 +password $2 +connect $1' | |
} | |
Start-Process "$path\quakelive.exe" "$arg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment