Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.IO.Compression
- Imports System.Net
- Imports System.Text
- Class WebCustom_update
- Dim version As String
- Dim versiona As String
- Public Shared Sub Main()
- Dim URI As String
- Dim Client As New Net.WebClient()
- '
- 'REPLACE Program WITH YOUR APPLICATIONS NAME.
- '
- 'REMEMBER TO EDIT FILEVERSION IN ASSEMBLY INFORMATION
- '
- '
- 'Edit URI to your version.html-file.
- URI = "https://dl.dropboxusercontent.com/u/78811967/Launcher/customversion.html"
- Dim wr As HttpWebRequest = CType(WebRequest.Create(URI.ToString), HttpWebRequest)
- Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
- Dim str As Stream = ws.GetResponseStream()
- Dim inBuf(100000) As Byte
- Dim bytesToRead As Integer = CInt(inBuf.Length)
- Dim bytesRead As Integer = 0
- If My.Computer.FileSystem.FileExists("customversion.txt") Then
- Else
- Dim path As String = "customversion.txt"
- ' Create or overwrite the file.
- Dim fs As FileStream = File.Create(path)
- ' Add text to the file.
- Dim info As Byte() = New UTF8Encoding(True).GetBytes("1000")
- fs.Write(info, 0, info.Length)
- fs.Close()
- End If
- Dim sranj As StreamReader = New System.IO.StreamReader("customversion.txt")
- Dim versiona As Integer = CInt(sranj.ReadToEnd.Replace(".", "").Substring(0, 4))
- sranj.Close()
- While bytesToRead > 0
- Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
- If n = 0 Then
- Exit While
- End If
- bytesRead += n
- bytesToRead -= n
- End While
- Dim fstr As New FileStream("customversion.txt", FileMode.OpenOrCreate, FileAccess.Write)
- fstr.Write(inBuf, 0, bytesRead)
- str.Close()
- fstr.Close()
- Dim sr As StreamReader = New System.IO.StreamReader("customversion.txt")
- Dim version As Integer = CInt(sr.ReadToEnd.Replace(".", "").Substring(0, 4))
- sr.Close()
- If version > versiona Then
- Dim readValue As String
- Dim NewValue As String
- Dim Nesta As String
- Dim Novo As String
- readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\SAMP", "gta_sa_exe", Nothing)
- Dim withoutParts As String = Replace(readValue, "\gta_sa.exe", "")
- NewValue = Replace(withoutParts, "\", "/")
- Nesta = "/SAMP"
- Novo = NewValue & Nesta
- Dim myWebClient As New WebClient()
- If My.Computer.FileSystem.FileExists(Novo & "\SAMP.img.backup") Then
- My.Computer.FileSystem.DeleteFile(Novo & "\SAMP.img")
- Else
- My.Computer.FileSystem.RenameFile(Novo & "\SAMP.img", "SAMP.img.backup")
- End If
- My.Computer.Network.DownloadFile("https://dl.dropboxusercontent.com/u/78811967/Launcher/SAMP.zip", Novo & "\SAMP.zip", "", "", True, 300000, True)
- MsgBox("Pricekajte da se otpakira. Kada se otpakira samo ce uci u igru!")
- System.IO.Compression.ZipFile.ExtractToDirectory(Novo & "/SAMP.zip", Novo)
- Dim NewValuea As String
- Dim Nestaa As String
- Dim Nesta2 As String
- NewValuea = Replace(withoutParts, "\", "/")
- Nestaa = "/samp.exe 95.178.183.124:7777 dokipeder"
- Nesta2 = NewValuea & Nestaa
- Shell(Nesta2)
- Else
- Dim readValue As String
- Dim NewValue As String
- Dim Nesta As String
- Dim Novo As String
- readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\SAMP", "gta_sa_exe", Nothing)
- Dim withoutParts As String = Replace(readValue, "\gta_sa.exe", "")
- NewValue = Replace(withoutParts, "\", "/")
- Nesta = "/SAMP"
- Novo = NewValue & Nesta
- Dim infoReader As System.IO.FileInfo
- infoReader = My.Computer.FileSystem.GetFileInfo(Novo & "\SAMP.zip")
- Dim wra As HttpWebRequest = CType(WebRequest.Create("https://dl.dropboxusercontent.com/u/78811967/Launcher/SAMP.zip".ToString), HttpWebRequest)
- Dim wsa As HttpWebResponse = CType(wra.GetResponse(), HttpWebResponse)
- If wsa.ContentLength <> infoReader.Length Then
- If My.Computer.FileSystem.FileExists(Novo & "\SAMP.img.backup") Then
- My.Computer.FileSystem.DeleteFile(Novo & "\SAMP.img")
- Else
- My.Computer.FileSystem.RenameFile(Novo & "\SAMP.img", "SAMP.img.backup")
- End If
- My.Computer.Network.DownloadFile("https://dl.dropboxusercontent.com/u/78811967/Launcher/SAMP.zip", Novo & "\SAMP.zip", "", "", True, 300000, True)
- MsgBox("Pricekajte da se otpakira. Kada se otpakira samo ce uci u igru!")
- System.IO.Compression.ZipFile.ExtractToDirectory(Novo & "/SAMP.zip", Novo)
- End If
- Dim NewValuea As String
- Dim Nestaa As String
- Dim Nesta2 As String
- NewValuea = Replace(withoutParts, "\", "/")
- Nestaa = "/samp.exe 95.178.183.124:7777 dokipeder"
- Nesta2 = NewValuea & Nestaa
- Shell(Nesta2)
- End If
- End Sub 'Main
- End Class 'Web_update
Advertisement
Add Comment
Please, Sign In to add comment