Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATA HOSTED WITH ♥ BY PASTEBIN.COM - DOWNLOAD RAW - SEE ORIGINAL
- Imports System.IO
- Imports System.Net
- Imports Ionic.Zip
- Imports Nini.Config
- Module Module1
- Dim iniSettings As New IniConfigSource(AppDomain.CurrentDomain.BaseDirectory & "\config\updater.ini")
- Sub Main()
- If My.Computer.FileSystem.FileExists(AppDomain.CurrentDomain.BaseDirectory & "\Update.zip") Then
- Console.WriteLine("Deleting old Update.zip...")
- My.Computer.FileSystem.DeleteFile(AppDomain.CurrentDomain.BaseDirectory & "\Update.zip")
- Console.WriteLine("Old Update.zip deleted...")
- Threading.Thread.Sleep(1500)
- Console.WriteLine("Downloading update...")
- Using updateClient As New WebClient
- updateClient.DownloadFile("https://github.com/OniSensei/Gotcha-v2.1/releases/download/1.0.0.0/Update.zip", "Update.zip")
- End Using
- Threading.Thread.Sleep(1500)
- Console.WriteLine("Downloading complete...")
- Else
- Threading.Thread.Sleep(1500)
- Console.WriteLine("Downloading update...")
- Using updateClient As New WebClient
- updateClient.DownloadFile("https://github.com/OniSensei/Gotcha-v2.1/releases/download/1.0.0.0/Update.zip", "Update.zip")
- End Using
- Threading.Thread.Sleep(1500)
- Console.WriteLine("Downloading complete...")
- End If
- Dim verURL As String = "https://raw.githubusercontent.com/OniSensei/Gotcha-v2.1/master/version.txt"
- Dim client As WebClient = New WebClient
- Dim reader As StreamReader = New StreamReader(client.OpenRead(verURL))
- Dim iVersion As String = reader.ReadToEnd
- Dim version As String = iniSettings.Configs("Updater").Get("Version")
- If iVersion.Contains(version) = False Then
- iniSettings.Configs("Updater").Set("Version", iVersion)
- iniSettings.Save()
- End If
- UnzipUpdate()
- End Sub
- Public Sub UnzipUpdate()
- Dim ziptoextract As String = AppDomain.CurrentDomain.BaseDirectory & "\Update.zip"
- Dim dir As String = AppDomain.CurrentDomain.BaseDirectory
- Console.WriteLine("Extracting file {0} to {1}", ziptoextract, dir)
- Using zip As ZipFile = ZipFile.Read(ziptoextract)
- Dim fn As String
- For Each fn In zip.EntryFileNames
- zip(fn).Extract(dir, ExtractExistingFileAction.OverwriteSilently)
- Next
- End Using
- Process.Start(AppDomain.CurrentDomain.BaseDirectory & "\Gotcha v2.1.exe")
- End
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement