I've been asked to make an application patcher so unstead of keeping it to myself i am releasing it to the public! If you have any questions feel free to ask.
i.imgur com/WL0cc41 .png
[/quote]
i.imgur com/WL0cc41 .png
Code
Imports System.Net
Imports System.IO
Imports System.IO.Compression
Public Class Form1
'Dims
Dim masterpath As String = "where is the installed program"
Dim versioncheck As String = "yoursite .com/version.txt"
Dim link As String = "direct link for zip file"
Dim zipPath As String = masterpath & "downloads\update.zip"
Dim extractPath As String = masterpath & "files"
Dim checkerplace As String = masterpath & "downloads\checker.dat"
'#########################################
'# #
'# Application Patcher #
'# Made by titanbullet #
'# Version 1.0.0.0 #
'# Don't forget to update #
'# the app.manifest #
'# #
'#########################################
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Gets if its the first time running the patcher. If it is,it opens "Installer" form.
If IO.File.Exists(checkerplace) Then My.Settings.Installed = True
If My.Settings.Installed = True Then
'Gets and sets the current application number
Dim currentversion As String
currentversion = Application.ProductVersion
oldversion.Text = currentversion
'Gets version.txt from server and sets it on label
Dim request = DirectCast(WebRequest.Create(versioncheck), HttpWebRequest)
Dim response = DirectCast(request.GetResponse(), HttpWebResponse)
Using sr As New StreamReader(response.GetResponseStream())
Dim versionnew As String
versionnew = sr.ReadLine
NewVersion.Text = versionnew
End Using
'Compares the versions and informs the user if needed
If oldversion.Text = NewVersion.Text Then
'Insert your form connection here (mainform.Show-Me.close)
ElseIf oldversion.Text < NewVersion.Text Then
MsgBox("New update found!", MsgBoxStyle.Critical, "Update found!")
'Deletes old files
IO.Directory.Delete(extractPath, True)
'Creates the directory again
IO.Directory.CreateDirectory(extractPath)
'Downloads the update package
My.Computer.Network.DownloadFile(link, masterpath & "downloads\update.zip")
'Extracts
ZipFile.ExtractToDirectory(zipPath, extractPath)
'Deletes the update zip
IO.File.Delete(masterpath & "downloads\update.zip")
End If
ElseIf My.Settings.Installed = False Then
'installer.show
End If
End Sub
End Class
