TonyVk

Untitled

Jun 6th, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Net
  3. Imports System.Text
  4. Imports System.Security
  5. Class WebCustom_update
  6. Dim version As String
  7. Dim versiona As String
  8. Public Shared Sub Main()
  9. Dim URI As String
  10. Dim Client As New Net.WebClient()
  11. '
  12. 'REPLACE Program WITH YOUR APPLICATIONS NAME.
  13. '
  14. 'REMEMBER TO EDIT FILEVERSION IN ASSEMBLY INFORMATION
  15. '
  16. '
  17. 'Edit URI to your version.html-file.
  18. URI = "https://dl.dropboxusercontent.com/u/78811967/Launcher/customversion.html"
  19.  
  20. Dim wr As HttpWebRequest = CType(WebRequest.Create(URI.ToString), HttpWebRequest)
  21. Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
  22. Dim str As Stream = ws.GetResponseStream()
  23. Dim inBuf(100000) As Byte
  24. Dim bytesToRead As Integer = CInt(inBuf.Length)
  25. Dim bytesRead As Integer = 0
  26.  
  27. If My.Computer.FileSystem.FileExists("customversion.txt") Then
  28.  
  29. Else
  30. Dim path As String = "customversion.txt"
  31.  
  32. ' Create or overwrite the file.
  33. Dim fs As FileStream = File.Create(path)
  34.  
  35. ' Add text to the file.
  36. Dim info As Byte() = New UTF8Encoding(True).GetBytes("1000")
  37. fs.Write(info, 0, info.Length)
  38. fs.Close()
  39. End If
  40. Dim sranj As StreamReader = New System.IO.StreamReader("customversion.txt")
  41. Dim versiona As Integer = CInt(sranj.ReadToEnd.Replace(".", "").Substring(0, 4))
  42. sranj.Close()
  43.  
  44. While bytesToRead > 0
  45. Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
  46. If n = 0 Then
  47. Exit While
  48. End If
  49. bytesRead += n
  50. bytesToRead -= n
  51. End While
  52. Dim fstr As New FileStream("customversion.txt", FileMode.OpenOrCreate, FileAccess.Write)
  53. fstr.Write(inBuf, 0, bytesRead)
  54. str.Close()
  55. fstr.Close()
  56. Dim sr As StreamReader = New System.IO.StreamReader("customversion.txt")
  57. Dim version As Integer = CInt(sr.ReadToEnd.Replace(".", "").Substring(0, 4))
  58. sr.Close()
  59. If version > versiona Then
  60.  
  61. Dim readValue As String
  62. Dim NewValue As String
  63. Dim Nesta As String
  64. Dim Novo As String
  65. readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\SAMP", "gta_sa_exe", Nothing)
  66. Dim withoutParts As String = Replace(readValue, "\gta_sa.exe", "")
  67. NewValue = Replace(withoutParts, "\", "/")
  68. Nesta = "/SAMP"
  69. Novo = NewValue & Nesta
  70. Dim myWebClient As New WebClient()
  71. If My.Computer.FileSystem.FileExists(Novo & "\SAMP.img.backup") Then
  72. My.Computer.FileSystem.DeleteFile(Novo & "\SAMP.img")
  73. Else
  74. My.Computer.FileSystem.RenameFile(Novo & "\SAMP.img", "SAMP.img.backup")
  75. End If
  76. My.Computer.Network.DownloadFile("https://dl.dropboxusercontent.com/u/78811967/Launcher/SAMP.img", Novo & "\SAMP.img", "", "", True, 300000, True)
  77. End If
  78. Dim readValuea As String
  79. Dim NewValuea As String
  80. Dim Nestaa As String
  81. Dim Nesta2 As String
  82. readValuea = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\SAMP", "gta_sa_exe", Nothing)
  83. Dim withoutPartsa As String = Replace(readValuea, "\gta_sa.exe", "")
  84. NewValuea = Replace(withoutPartsa, "\", "/")
  85. Nestaa = "/samp.exe 5.43.184.174:7777 dokipeder"
  86. Nesta2 = NewValuea & Nestaa
  87. Shell(Nesta2)
  88. End Sub 'Main
  89. End Class 'Web_update
Advertisement
Add Comment
Please, Sign In to add comment