PrankyMat's Program Updater 1.0

Introduction
Ever wanted to update your client's program? Here is a dll library that you should use in your Visual Basic project. It is fairly easy to use.

!!!WARNING!!!
In order to use this library, you first need to have either a file server or dropbox. Upload the updated installer to the server and create a file named "Version.txt" containing  the version of the updated file.
Include the public link to the code and it should work. 

Example:

Imports Update.Update

Public Class Form1

    'Declaration of the update library
    Dim updater As New Update.Update

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Checks for internet connection
        If updater.CheckConnection() = False Then
            'Alert user that internet connection is not available
            MsgBox("No internet connection available!", MsgBoxStyle.Critical)
            'Optional: Application.Restart() <- Restarts the program
            'Optional: Application.Exit() <- Quits the program
        End If

        'Checking if new version is available.
        'CheckIfNewVersion("CURRENT_VERSION", New Uri("LINK_TO_THE_VERSION_TEXT_FILE"))
        If updater.CheckIfNewVersion("0.1", New Uri("https://dropbox.com/XXXXX/Version.txt")) Then
            'New update is available
            MsgBox("New update is available! Download?", MsgBoxStyle.OkCancel)
            If MsgBoxResult.Ok Then

                'MsgBox OK pressed, start the download
                Dim DownloadedFilePath As String
                DownloadedFilePath = _
                updater.DownloadUpdatedFile(New Uri("https://dropbox.com/XXXXX/update.exe"))

                'Run the update installer
                Shell(DownloadedFilePath, AppWinStyle.NormalFocus, False)

            Else
                'MsgBox CANCEL pressed
            End If
        Else
            'Program is up to date
            'MsgBox("Your program is up-to-date", MsgBoxStyle.Information)
        End If

    End Sub
End Class

 


Last edited Jan 24, 2013 at 11:41 AM by prankymat, version 2

Comments

No comments yet.