Partial Class _Default Inherits System.Web.UI.Page Dim isStarted = 0 Dim GameProcessKiller As System.Diagnostics.Process = New System.Diagnostics.Process Dim GameProcess As System.Diagnostics.Process = New System.Diagnostics.Process REM Dim s As String Protected Sub uxStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uxStart.Click System.IO.Directory.SetCurrentDirectory("C:\q3ademo") GameProcess.StartInfo.FileName = "C:\q3ademo\quake3.exe" GameProcess.StartInfo.Arguments = "+set dedicated 2 +set net_port 27970 +com_hunkMegs 50 +exec myserver.cfg" GameProcess.StartInfo.UseShellExecute = False GameProcess.StartInfo.CreateNoWindow = True GameProcess.StartInfo.RedirectStandardInput = True GameProcess.StartInfo.RedirectStandardOutput = True GameProcess.StartInfo.RedirectStandardError = True GameProcess.Start() REM Dim sIn As System.IO.StreamWriter = GameProcess.StandardInput REM sIn.AutoFlush = True REM Dim sOut As System.IO.StreamReader = GameProcess.StandardOutput REM Dim sErr As System.IO.StreamReader = GameProcess.StandardError REM REM sIn.Write("dir c:\windows\system32\*.com" & _ REM REM System.Environment.NewLine) REM REM sIn.Write("exit" & System.Environment.NewLine) REM s = sOut.ReadToEnd() REM sIn.Close() REM sOut.Close() REM sErr.Close() REM uxReturnValue.Text = s uxReturnValue.Text = GameProcess.Id uxStatus.Text = "Running" isStarted = 1 End Sub Protected Sub uxStop_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uxStop.Click GameProcess = System.Diagnostics.Process.GetProcessById(uxReturnValue.Text) GameProcess.Kill() uxStatus.Text = "Stopped" isStarted = 0 End Sub Protected Sub uxRestart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uxRestart.Click If isStarted = 1 Then GameProcess = System.Diagnostics.Process.GetProcessById(uxReturnValue.Text) GameProcess.Kill() System.IO.Directory.SetCurrentDirectory("C:\q3ademo") GameProcess.StartInfo.FileName = "C:\q3ademo\quake3.exe" GameProcess.StartInfo.Arguments = "+set dedicated 2 +set net_port 27970 +com_hunkMegs 50 +exec myserver.cfg" GameProcess.StartInfo.UseShellExecute = False GameProcess.StartInfo.CreateNoWindow = True GameProcess.StartInfo.RedirectStandardInput = True GameProcess.StartInfo.RedirectStandardOutput = True GameProcess.StartInfo.RedirectStandardError = True GameProcess.Start() uxReturnValue.Text = GameProcess.Id Else System.IO.Directory.SetCurrentDirectory("C:\q3ademo") GameProcess.StartInfo.FileName = "C:\q3ademo\quake3.exe" GameProcess.StartInfo.Arguments = "+set dedicated 2 +set net_port 27970 +com_hunkMegs 50 +exec myserver.cfg" GameProcess.StartInfo.UseShellExecute = False GameProcess.StartInfo.CreateNoWindow = True GameProcess.StartInfo.RedirectStandardInput = True GameProcess.StartInfo.RedirectStandardOutput = True GameProcess.StartInfo.RedirectStandardError = True GameProcess.Start() uxReturnValue.Text = GameProcess.Id End If End Sub End Class