Skip to content

Instantly share code, notes, and snippets.

@snapcase
Created February 22, 2014 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snapcase/9149018 to your computer and use it in GitHub Desktop.
Save snapcase/9149018 to your computer and use it in GitHub Desktop.
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