Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 [Help] Gather Information from console app to vb.net program

$
0
0
Hey folks

What i am trying to do here is i want to get all the information from a console app i have (See below)

Attachment 95313

And i want it all to go into a textbox i have in a windows form (See below)

Attachment 95315

I have some coding done but so far it is only for executing the server and hiding the thread

Code:

Private Sub btn_worldstart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_worldstart.Click
        If btn_worldstart.Text = "Start World Server" Then
            If My.MySettings.[Default].arcemuworld <> [String].Empty Then

                If loginprocid <> 0 Then

                    'Check if authserver is running before starting the world server

                    Dim exists As Boolean = False

                    For Each p As Process In Process.GetProcesses()
                        If p.Id = loginprocid AndAlso loginprocid <> 0 Then
                            exists = True
                        End If
                    Next

                    If exists = True Then

                        If Not loginproc.HasExited Then

                            Dim serverExists As Boolean = False
                            Dim pid As Integer = 0

                            For Each p As Process In Process.GetProcesses()
                                If p.ProcessName.Contains("arcemu-world") Then
                                    serverExists = True
                                    pid = p.Id
                                End If
                            Next

                            If serverExists = False Then

                                Dim thread As New Thread(New ParameterizedThreadStart(AddressOf ExecuteWorldServer))
                                thread.IsBackground = True
                                thread.Priority = ThreadPriority.AboveNormal

                                thread.Start()

                                lbl_worldstatus.Text = "World Server Status: Online"
                                btn_worldstart.Text = "Stop World Server"
                            Else
                                Dim result As DialogResult = MessageBox.Show("World Server is already running! Kill it?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

                                If result = DialogResult.Yes Then
                                    Dim p As Process = Process.GetProcessById(pid)

                                    p.Kill()
                                End If
                            End If
                        End If
                    Else
                        MessageBox.Show("Logon Server must be opened first!", "ArcEmu Manager", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                    End If
                Else
                    MessageBox.Show("Logon Server must be opened first!", "ArcEmu Manager", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                End If
            Else
                MessageBox.Show("You must set where arcemu-world.exe is located.", "ArcEmu Manager", MessageBoxButtons.OK, MessageBoxIcon.[Error])
            End If
        Else
            Dim exists As Boolean = False

            For Each p As Process In Process.GetProcesses()
                If p.Id = worldprocid AndAlso worldprocid <> 0 Then
                    exists = True
                End If
            Next
            If exists = True Then
                If Not worldproc.HasExited Then
                    worldproc.Kill()

                    worldproc.Close()
                    worldproc.Dispose()

                    lbl_worldstatus.Text = "World Server Status: Offline"
                    btn_worldstart.Text = "Start World Server"
                End If
            Else
                MessageBox.Show("World Server is Not Running!")
            End If


        End If
    End Sub

Private Sub ExecuteWorldServer(ByVal obj As Object)
        Try
            Dim procStartInfo As System.Diagnostics.ProcessStartInfo = New ProcessStartInfo()

            Dim dirname As String = Path.GetDirectoryName(My.MySettings.[Default].arcemuworld)

            procStartInfo.WorkingDirectory = dirname

            procStartInfo.FileName = My.MySettings.[Default].arcemuworld

            procStartInfo.UseShellExecute = True

            If My.MySettings.[Default].showworld = True Then
                procStartInfo.WindowStyle = ProcessWindowStyle.Normal
            Else
                procStartInfo.WindowStyle = ProcessWindowStyle.Hidden
            End If

            worldproc = New Process()

            worldproc.StartInfo = procStartInfo
            worldproc.Start()

            worldproc.EnableRaisingEvents = True


            worldprocid = worldproc.Id
        Catch ex As Exception
            MessageBox.Show(ex.Message, "ArcEmu Manager", MessageBoxButtons.OK, MessageBoxIcon.[Error])
        End Try
    End Sub

I hope someone can help me with this

Thanks :)
Attached Images
   

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>