How to make an auto updater! For noobs :) menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    EmiloZ's Avatar Flying Piggy Back
    CoreCoins Purchaser
    Reputation
    538
    Join Date
    Jun 2007
    Posts
    1,393
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make an auto updater! For noobs :)

    Ok, you got your program ready, now make this :

    • A label with text "Version : "
    • A .txt file on your webserver with text like "1.3.0" which is program version!


    When made the label then double click the form so it will be in the codes under "Form Load"

    Then insert this code
    Code:
    Using wc As New Net.WebClient()
                Dim url As String = "http://yoursite.com/version.txt"
                Dim src As String = wc.DownloadString(url)
                Dim myVersion As String = "Version: "
                Dim myVersions As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(src)
                If myVersions IsNot Nothing Then
                    myVersion = myVersions.Value
                End If
                Label1.Text = ("Version: " + myVersions)
            End Using
    'This is for dl!
            If myVersions.Value = "1.2.9" Then My.Computer.Network.DownloadFile("http://yoursite.com/app.exe" ,"C:/app.exe") Else Do Nothing
    Enjoy guys!
    Why fill up a signature?

    How to make an auto updater! For noobs :)
  2. #2
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Might I suggest using the TEMP directory, rather than the C drive? I use similar code for the same purpose:

    Code:
    Imports System.IO
    Imports System.Net
    Imports System.Text
    Imports System.Diagnostics.Process
    
    Dim CurrentVersion as String = "1.0.2"
    
    Private Sub UpdateCheck()
            'Download the text file
            Dim LocalFile As String = Path.GetTempFileName
            DownloadFile("http://www.website.com/version-latest.txt", LocalFile)
    
            'Read the text file and get the current version
            Dim Reader As TextReader = New StreamReader(LocalFile)
            Dim LatestVersion As String
            LatestVersion = Reader.ReadToEnd
            Reader.Close()
    
            'Compare the numbers and ask to update (if appropriate)
            If Not LatestVersion <> CurrentVersion Then
                If MsgBox("You are currently running an outdated version of <PROGRAM NAME>. Would you like to update?", MsgBoxStyle.YesNo, "PROGRAM NAME") = vbYes Then
                    DownloadFile("http://www.website.com/Program-" & LatestVersion & "Update.exe", Path.GetTempPath & "Program-Update.exe")
                    Start(Path.GetTempPath & "\Program-Update.exe")
                    File.Delete(LocalFile)
                    End
                End If
            End If
    
            'Delete the temporary text file
            File.Delete(LocalFile)
        End Sub
    It allows them to decide if they want to update or not, and clears all unused things afterwards. Though I should really learn regex at some point...

    (oh yeah, I just call UpdateCheck when the program starts up.)

  3. #3
    Fireking300's Avatar Active Member
    Reputation
    27
    Join Date
    Jun 2007
    Posts
    92
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice Coding both of yall. +Rep x2 to both.
    Edit: I gave rep to EmiloZ, but I have to spread around some reputation before I can give more to ReidE96.

  4. #4
    Allstar .ιllιlı.'s Avatar Banned
    Reputation
    284
    Join Date
    Jan 2009
    Posts
    481
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not bad, but shouldn't the version numbers be online somewhere? Like in a database?

    That way, you won't have to change it in your code everytime.
    I suggest you download a .txt file which contains the newest version number, and compare it with your version. Or you can use a database (like I did with Allstar to get the newest version number.).


    EDIT: This only aplies to Emiloz. ReidE96 already has an online version number.

    Greetz

  5. #5
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just encrypt a txt file? and it will have numbers in it :P that program will read?

    Find about scripting, programming and music! My blog: https://worldofsmth.wordpress.com!

Similar Threads

  1. [How To] Make Trainers Train You For Free
    By Ebon in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 08-17-2018, 03:46 PM
  2. How to make custom items / vendors for your private server (edited name)
    By renitharis in forum WoW EMU Guides & Tutorials
    Replies: 67
    Last Post: 06-16-2016, 05:08 AM
  3. Replies: 12
    Last Post: 04-07-2009, 06:40 AM
  4. [Site] How about making a real logo for MMOwned?
    By Andrige in forum Suggestions
    Replies: 36
    Last Post: 11-24-2007, 11:16 AM
  5. [Question] How to make the solo files for model change?
    By TheAussieTroll in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 10-09-2007, 01:14 PM
All times are GMT -5. The time now is 09:22 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search