Advertisement
Guest User

PokeCord

a guest
Feb 19th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. DATA HOSTED WITH ♥ BY PASTEBIN.COM - DOWNLOAD RAW - SEE ORIGINAL
  2. Imports System.IO
  3. Imports System.Net
  4. Imports Ionic.Zip
  5. Imports Nini.Config
  6.  
  7. Module Module1
  8. Dim iniSettings As New IniConfigSource(AppDomain.CurrentDomain.BaseDirectory & "\config\updater.ini")
  9.  
  10. Sub Main()
  11. If My.Computer.FileSystem.FileExists(AppDomain.CurrentDomain.BaseDirectory & "\Update.zip") Then
  12. Console.WriteLine("Deleting old Update.zip...")
  13. My.Computer.FileSystem.DeleteFile(AppDomain.CurrentDomain.BaseDirectory & "\Update.zip")
  14. Console.WriteLine("Old Update.zip deleted...")
  15. Threading.Thread.Sleep(1500)
  16. Console.WriteLine("Downloading update...")
  17. Using updateClient As New WebClient
  18. updateClient.DownloadFile("https://github.com/OniSensei/Gotcha-v2.1/releases/download/1.0.0.0/Update.zip", "Update.zip")
  19. End Using
  20. Threading.Thread.Sleep(1500)
  21. Console.WriteLine("Downloading complete...")
  22. Else
  23. Threading.Thread.Sleep(1500)
  24. Console.WriteLine("Downloading update...")
  25. Using updateClient As New WebClient
  26. updateClient.DownloadFile("https://github.com/OniSensei/Gotcha-v2.1/releases/download/1.0.0.0/Update.zip", "Update.zip")
  27. End Using
  28. Threading.Thread.Sleep(1500)
  29. Console.WriteLine("Downloading complete...")
  30. End If
  31.  
  32. Dim verURL As String = "https://raw.githubusercontent.com/OniSensei/Gotcha-v2.1/master/version.txt"
  33. Dim client As WebClient = New WebClient
  34. Dim reader As StreamReader = New StreamReader(client.OpenRead(verURL))
  35. Dim iVersion As String = reader.ReadToEnd
  36. Dim version As String = iniSettings.Configs("Updater").Get("Version")
  37.  
  38. If iVersion.Contains(version) = False Then
  39. iniSettings.Configs("Updater").Set("Version", iVersion)
  40. iniSettings.Save()
  41. End If
  42.  
  43. UnzipUpdate()
  44. End Sub
  45.  
  46. Public Sub UnzipUpdate()
  47. Dim ziptoextract As String = AppDomain.CurrentDomain.BaseDirectory & "\Update.zip"
  48. Dim dir As String = AppDomain.CurrentDomain.BaseDirectory
  49.  
  50. Console.WriteLine("Extracting file {0} to {1}", ziptoextract, dir)
  51. Using zip As ZipFile = ZipFile.Read(ziptoextract)
  52. Dim fn As String
  53. For Each fn In zip.EntryFileNames
  54. zip(fn).Extract(dir, ExtractExistingFileAction.OverwriteSilently)
  55. Next
  56. End Using
  57.  
  58. Process.Start(AppDomain.CurrentDomain.BaseDirectory & "\Gotcha v2.1.exe")
  59. End
  60. End Sub
  61. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement