alterware-launcher/Program.vb

40 lines
1.2 KiB
VB.net
Raw Normal View History

2023-06-01 05:51:04 -04:00
Imports System
2023-06-01 06:23:23 -04:00
Imports System.IO
Imports System.Net
Imports System.Net.Http
2023-06-01 05:51:04 -04:00
Module Program
2023-06-01 06:23:23 -04:00
Private master As String = "https://master.alterware.dev"
Sub download_and_run(game As String)
Dim filename As String = game & ".exe"
Dim remote_path As String = If(game = "iw4-sp", "/iw4/", "/iw5/")
Console.WriteLine("Downloading " & game & "...")
Using wc As New WebClient
wc.DownloadFile(master & remote_path & filename, filename)
End Using
Console.WriteLine("Starting " & game)
Dim p As Process = Process.Start(filename)
p.WaitForExit()
2023-06-01 06:23:23 -04:00
End
End Sub
2023-06-01 05:51:04 -04:00
Sub Main(args As String())
2023-06-01 06:23:23 -04:00
Dim game As String
Try
game = args(0)
Catch ex As Exception
If File.Exists("iw4sp.exe") Or File.Exists("iw4mp.exe") Then
game = "iw4-sp"
ElseIf File.Exists("iw5sp.exe") Or File.Exists("iw5mp.exe") Or File.Exists("iw5mp_server.exe") Then
game = "iw5-mod"
Else
Console.WriteLine("No game specified nor found in local directory")
Console.ReadLine()
Return
End If
End Try
download_and_run(game)
2023-06-01 05:51:04 -04:00
End Sub
2023-06-01 06:23:23 -04:00
End Module