Imports System.Net Imports System.IO Imports System.Text Public Class Form1 Dim ServerIP As String = "50.25.200.66" Dim ClientExe As String = "HeroGameSecurity.exe" Dim ServerPort As String = "9010" Dim WebsiteAddress As String = "http://heroesofisya.com:8080/Login/" Dim CashShopAddress As String = "http://heroesofisya.com:8080/Login/" Dim ForumAddress As String = "http://heroesofisya.com:8080/" Dim Top100Address As String = "http://heroesofisya.com:8080/" Dim SignUpAddress As String = "http://heroesofisya.com:8080/" Dim cpx, cpy As Int32 Friend WithEvents downloader As New Net.WebClient Dim wc As New WebClient Dim MyFunction As New MyFunction Dim ClientConfigFile As String() = Nothing Dim PatchList As String() = Nothing Private Sub downloadPatches() If ServerVersionlabel.Text = ClientVersionLabel.Text Then LaunchBtn.Enabled = True StatusLabel.Text = "No new Updates avaiable!" PatchProgressLabel.Hide() ElseIf Val(ClientVersionLabel.Text) > Val(ServerVersionlabel.Text) Then MessageBox.Show("Overpatched. I'll restart now to repatch.", "Patcher :: Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Directory.Delete("Launcher", True) Application.Restart() Else StatusLabel.Text = "Getting Patch: " & ClientVersionLabel.Text ProgressBar1.Value = 0 downloader.DownloadFileAsync(New Uri(PatchList(Val(ClientVersionLabel.Text) + Val(1)).Split(vbTab)(1)), "patch.rar") End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not File.Exists("UnRAR.exe") Then My.Computer.Network.DownloadFile(WebsiteAddress & "UnRAR.exe", "UnRAR.exe") End If If Not File.Exists("Launcher/config.lul") Then Directory.CreateDirectory("Launcher") File.WriteAllText("Launcher/config.lul", MyFunction.Encrypt("Version=0")) End If ClientConfigFile = IO.File.ReadAllLines("Launcher/config.lul") ClientConfigFile(0) = MyFunction.Decrypt(ClientConfigFile(0)) PatchList = wc.DownloadString(WebsiteAddress & "list.txt").Split(vbNewLine) ClientVersionLabel.Text = ClientConfigFile(0).Split("=")(1) ServerVersionlabel.Text = MyFunction.CountPatches(WebsiteAddress & "list.txt") downloadPatches() End Sub Private Sub downloader_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles downloader.DownloadFileCompleted ClientVersionLabel.Text = Val(ClientVersionLabel.Text) + Val(1) Dim oProcess As Process oProcess = System.Diagnostics.Process.Start("UnRAR.exe", "x -y -ac patch.rar") oProcess.WaitForExit() File.Delete("patch.rar") IO.File.WriteAllText("Launcher/config.lul", MyFunction.Encrypt("LauncherVersion=" & ClientVersionLabel.Text)) downloadPatches() End Sub Private Sub downloader_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles downloader.DownloadProgressChanged PatchProgressLabel.Text = e.ProgressPercentage & "%" ProgressBar1.Value = e.ProgressPercentage End Sub Private Sub PictureBox3_Click_1(sender As System.Object, e As System.EventArgs) Handles LaunchBtn.Click Process.Start(ClientExe, " -i " & ServerIP & " -p " & ServerPort) Environment.Exit(0) End Sub Private Sub PictureBox4_Click_1(sender As System.Object, e As System.EventArgs) Handles Forum.Click Process.Start(ForumAddress) End Sub Private Sub PictureBox7_Click_1(sender As System.Object, e As System.EventArgs) Handles Signup.Click Process.Start(SignUpAddress) End Sub Private Sub PictureBox6_Click(sender As System.Object, e As System.EventArgs) Handles Homepage.Click Process.Start(WebsiteAddress) End Sub Private Sub PictureBox2_Click_2(sender As System.Object, e As System.EventArgs) Handles Top100.Click Process.Start(Top100Address) End Sub Private Sub PictureBox8_Click(sender As System.Object, e As System.EventArgs) Handles Closebtn.Click Environment.Exit(0) End Sub Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown cpx = e.X cpy = e.Y End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then Top = Windows.Forms.Cursor.Position.Y() - cpy Left = Cursor.Position.X() - cpx End If End Sub End Class