OS Server restarter [VB.Net]

This forum contains the items, weapons, resources or other files shared between players.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Forum rules
Client Editing is a delicate subject. osRose and osiRose will not support or use any Client Editing tool or results as a standard. So you are free to experiment, test, and develop there on Client Editing, but at your own risk :)
Don't share ANY files, graphics, items that don't belong to you.

OS Server restarter [VB.Net]

Postby -DefaulT on Thu Feb 10, 2011 12:48 am

Made for some guy named vick on ragezone, figured i would just release it :P

Download restarter.zip

Took me like 30 min to make so nothing fancy.

Extract the exe to your folder with your login, char, and world servers, then when u open it up in the top right corner set the timer interval (in milliseconds) then click the login, char, and world button, to stop it press the corresponding stop button.

You will need .net framework 3.5 so get that first.

Pic:
Image

And source:
  1. Imports System
  2. Imports System.IO
  3. Imports System.Data
  4.  
  5. Public Class Form1
  6.     'Dragging form w/o borders :D
  7. #Region " ClientAreaMove Handling "
  8.     Const WM_NCHITTEST As Integer = &H84
  9.     Const HTCLIENT As Integer = &H1
  10.     Const HTCAPTION As Integer = &H2
  11.     Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
  12.         Select Case m.Msg
  13.             Case WM_NCHITTEST
  14.                 MyBase.WndProc(m)
  15.                 If m.Result = HTCLIENT Then m.Result = HTCAPTION
  16.             Case Else
  17.                 MyBase.WndProc(m)
  18.         End Select
  19.     End Sub
  20. #End Region
  21.  
  22.  
  23.     Public Sub GetProcesses()
  24.  
  25.         ListBox1.Items.Clear()
  26.         Dim p As Process
  27.         For Each p In Process.GetProcesses
  28.             ListBox1.Items.Add(p.ProcessName)
  29.         Next
  30.  
  31.     End Sub
  32.  
  33.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
  34.  
  35.         Try
  36.             Dim l = "LoginServer"
  37.             ListBox1.SelectedItem = l
  38.             If ListBox1.SelectedItem = l Then
  39.                 GetProcesses()
  40.             Else
  41.                 Shell("LoginServer.exe")
  42.             End If
  43.             GetProcesses()
  44.         Catch ex As Exception
  45.             MsgBox("Error - Cant find LoginServer.exe")
  46.         End Try
  47.  
  48.     End Sub
  49.  
  50.     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
  51.  
  52.         Try
  53.             Dim c = "CharServer"
  54.             ListBox1.SelectedItem = c
  55.             If ListBox1.SelectedItem = c Then
  56.                 GetProcesses()
  57.             Else
  58.                 Shell("CharServer.exe")
  59.             End If
  60.             GetProcesses()
  61.         Catch ex As Exception
  62.             MsgBox("Error - Cant find CharServer.exe")
  63.         End Try
  64.  
  65.     End Sub
  66.  
  67.     Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
  68.  
  69.         Try
  70.             Dim w = "WorldServer"
  71.             ListBox1.SelectedItem = w
  72.             If ListBox1.SelectedItem = w Then
  73.                 GetProcesses()
  74.             Else
  75.                 Shell("WorldServer.exe")
  76.             End If
  77.             GetProcesses()
  78.         Catch ex As Exception
  79.             MsgBox("Error - Cant find WorldServer.exe")
  80.         End Try
  81.  
  82.     End Sub
  83.  
  84.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  85.         GetProcesses()
  86.     End Sub
  87.  
  88.     Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
  89.         MsgBox("ROSE Restarter coded by -DefaulT - d.faultx@gmail.com")
  90.     End Sub
  91.  
  92.     Private Sub PictureBox6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox6.Click
  93.         If TextBox1.Text > "64767" Then
  94.             MsgBox("Error - You can not set the interval larger than 64,767 ms. (1 minute 7 seconds)")
  95.         ElseIf TextBox1.Text <= "0" Then
  96.             MsgBox("Error - You should set the interval greater than 0 ms.")
  97.         Else
  98.             Timer1.Interval = TextBox1.Text
  99.             Timer1.Start()
  100.             PictureBox9.Enabled = True
  101.             PictureBox6.Enabled = False
  102.             PictureBox12.Enabled = False
  103.             PictureBox3.Image = My.Resources.login2
  104.         End If
  105.     End Sub
  106.  
  107.     Private Sub PictureBox7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.Click
  108.         If TextBox1.Text > "64767" Then
  109.             MsgBox("Error - You can not set the interval larger than 64,767 ms. (1 minute 7 seconds)")
  110.         ElseIf TextBox1.Text <= "0" Then
  111.             MsgBox("Error - You should set the interval greater than 0 ms.")
  112.         Else
  113.             Timer2.Interval = TextBox1.Text
  114.             Timer2.Start()
  115.             PictureBox10.Enabled = True
  116.             PictureBox7.Enabled = False
  117.             PictureBox12.Enabled = False
  118.             PictureBox4.Image = My.Resources.char2
  119.         End If
  120.     End Sub
  121.  
  122.     Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox8.Click
  123.         If TextBox1.Text > "64767" Then
  124.             MsgBox("Error - You can not set the interval larger than 64,767 ms. (1 minute 7 seconds)")
  125.         ElseIf TextBox1.Text <= "0" Then
  126.             MsgBox("Error - You should set the interval greater than 0 ms.")
  127.         Else
  128.             Timer3.Interval = TextBox1.Text
  129.             Timer3.Start()
  130.             PictureBox11.Enabled = True
  131.             PictureBox8.Enabled = False
  132.             PictureBox12.Enabled = False
  133.             PictureBox5.Image = My.Resources.world2
  134.         End If
  135.     End Sub
  136.  
  137.     Private Sub PictureBox9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox9.Click
  138.         Timer1.Stop()
  139.         PictureBox9.Enabled = False
  140.         PictureBox6.Enabled = True
  141.         If PictureBox6.Enabled = True And PictureBox7.Enabled = True And PictureBox8.Enabled = True Then
  142.             PictureBox12.Enabled = True
  143.         End If
  144.         PictureBox3.Image = My.Resources.login3
  145.     End Sub
  146.  
  147.     Private Sub PictureBox10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox10.Click
  148.         Timer2.Stop()
  149.         PictureBox10.Enabled = False
  150.         PictureBox7.Enabled = True
  151.         If PictureBox6.Enabled = True And PictureBox7.Enabled = True And PictureBox8.Enabled = True Then
  152.             PictureBox12.Enabled = True
  153.         End If
  154.         PictureBox4.Image = My.Resources.char3
  155.     End Sub
  156.  
  157.     Private Sub PictureBox11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox11.Click
  158.         Timer3.Stop()
  159.         PictureBox11.Enabled = False
  160.         PictureBox8.Enabled = True
  161.         If PictureBox6.Enabled = True And PictureBox7.Enabled = True And PictureBox8.Enabled = True Then
  162.             PictureBox12.Enabled = True
  163.         End If
  164.         PictureBox5.Image = My.Resources.world3
  165.     End Sub
  166.  
  167.     Private Sub PictureBox12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox12.Click
  168.         If TextBox1.Text > "64767" Then
  169.             MsgBox("Error - You can not set the interval larger than 64,767 ms. (1 minute 7 seconds)")
  170.         ElseIf TextBox1.Text <= "0" Then
  171.             MsgBox("Error - You should set the interval greater than 0 ms.")
  172.         Else
  173.             If PictureBox6.Enabled = True And PictureBox7.Enabled = True And PictureBox8.Enabled = True Then
  174.                 Timer1.Interval = TextBox1.Text
  175.                 Timer2.Interval = TextBox1.Text
  176.                 Timer3.Interval = TextBox1.Text
  177.                 Timer1.Start()
  178.                 Timer2.Start()
  179.                 Timer3.Start()
  180.                 PictureBox6.Enabled = False
  181.                 PictureBox9.Enabled = True
  182.                 PictureBox7.Enabled = False
  183.                 PictureBox8.Enabled = False
  184.                 PictureBox12.Enabled = False
  185.                 PictureBox10.Enabled = True
  186.                 PictureBox11.Enabled = True
  187.                 PictureBox13.Enabled = True
  188.                 PictureBox3.Image = My.Resources.login2
  189.                 PictureBox4.Image = My.Resources.char2
  190.                 PictureBox5.Image = My.Resources.world2
  191.             Else
  192.                 MsgBox("Error - One or more of the servers are already set to restart.")
  193.             End If
  194.         End If
  195.     End Sub
  196.  
  197.     Private Sub PictureBox13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox13.Click
  198.         If PictureBox6.Enabled = False And PictureBox7.Enabled = False And PictureBox8.Enabled = False Then
  199.             Timer1.Stop()
  200.             Timer2.Stop()
  201.             Timer3.Stop()
  202.             PictureBox6.Enabled = True
  203.             PictureBox9.Enabled = False
  204.             PictureBox7.Enabled = True
  205.             PictureBox8.Enabled = True
  206.             PictureBox12.Enabled = True
  207.             PictureBox10.Enabled = False
  208.             PictureBox11.Enabled = False
  209.             PictureBox13.Enabled = False
  210.             PictureBox3.Image = My.Resources.login3
  211.             PictureBox4.Image = My.Resources.char3
  212.             PictureBox5.Image = My.Resources.world3
  213.         Else
  214.             MsgBox("Error - One or more of the servers are already turned off.")
  215.         End If
  216.     End Sub
  217.  
  218.     Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
  219.         Me.Close()
  220.     End Sub
  221.  
  222.     Private Sub PictureBox6_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox6.MouseHover
  223.         PictureBox6.Image = My.Resources.lstart2
  224.     End Sub
  225.  
  226.     Private Sub PictureBox6_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox6.MouseLeave
  227.         PictureBox6.Image = My.Resources.lstart1
  228.     End Sub
  229.  
  230.     Private Sub PictureBox7_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox7.MouseHover
  231.         PictureBox7.Image = My.Resources.cstart2
  232.     End Sub
  233.  
  234.     Private Sub PictureBox7_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox7.MouseLeave
  235.         PictureBox7.Image = My.Resources.cstart1
  236.     End Sub
  237.  
  238.     Private Sub PictureBox8_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox8.MouseHover
  239.         PictureBox8.Image = My.Resources.wstart2
  240.     End Sub
  241.  
  242.     Private Sub PictureBox12_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox12.MouseHover
  243.         PictureBox12.Image = My.Resources.astart2
  244.     End Sub
  245.  
  246.     Private Sub PictureBox12_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox12.MouseLeave
  247.         PictureBox12.Image = My.Resources.astart1
  248.     End Sub
  249.  
  250.     Private Sub PictureBox8_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox8.MouseLeave
  251.         PictureBox8.Image = My.Resources.wstart1
  252.     End Sub
  253.  
  254.     Private Sub PictureBox9_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox9.MouseHover
  255.         PictureBox9.Image = My.Resources.lstop2
  256.     End Sub
  257.  
  258.     Private Sub PictureBox9_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox9.MouseLeave
  259.         PictureBox9.Image = My.Resources.lstop1
  260.     End Sub
  261.  
  262.     Private Sub PictureBox10_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox10.MouseHover
  263.         PictureBox10.Image = My.Resources.cstop2
  264.     End Sub
  265.  
  266.     Private Sub PictureBox10_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox10.MouseLeave
  267.         PictureBox10.Image = My.Resources.cstop1
  268.     End Sub
  269.  
  270.     Private Sub PictureBox11_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox11.MouseHover
  271.         PictureBox11.Image = My.Resources.wstop2
  272.     End Sub
  273.  
  274.     Private Sub PictureBox11_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox11.MouseLeave
  275.         PictureBox11.Image = My.Resources.wstop1
  276.     End Sub
  277.  
  278.     Private Sub PictureBox13_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox13.MouseHover
  279.         PictureBox13.Image = My.Resources.astop2
  280.     End Sub
  281.  
  282.     Private Sub PictureBox13_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox13.MouseLeave
  283.         PictureBox13.Image = My.Resources.lstop1
  284.     End Sub
  285. End Class
  286.  



-Edit
Updated source code to add more checks for possible errors and to keep the application from crashing and/or overloading your computer etc. Also added a bit more functionality and i redid the UI to be a little more professional looking.
Last edited by -DefaulT on Fri Feb 11, 2011 9:49 pm, edited 1 time in total.
Image
User avatar
-DefaulT
Smoulie
Smoulie
 
Posts: 44
Joined: Wed Sep 12, 2007 5:16 am

Re: OS Server restarter [VB.Net]

Postby Juan on Thu Feb 10, 2011 10:43 am

VBMan
User avatar
Juan
Rackie
Rackie
 
Posts: 219
Joined: Fri Oct 10, 2008 6:25 pm

Re: OS Server restarter [VB.Net]

Postby -DefaulT on Fri Feb 11, 2011 5:45 pm

What? o.O
Image
User avatar
-DefaulT
Smoulie
Smoulie
 
Posts: 44
Joined: Wed Sep 12, 2007 5:16 am


Return to Submit client ressources

Who is online

Users browsing this forum: No registered users and 1 guest

cron