Advertisement
john_oneill

[VB.NET] Updater Snippet

Dec 16th, 2011
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.34 KB | None | 0 0
  1. '''''''''''''''''''''''''''''
  2. '     Updater Snippet       '
  3. '                           '
  4. ' Creator : John            '
  5. ' Date : 17/12/2011         '
  6. ' Site : FiveStarGamerz.com '
  7. '                           '
  8. '                           '
  9. '        Enjoy :D           '
  10. '''''''''''''''''''''''''''''
  11.  
  12. Imports System.Net
  13. Imports System.IO
  14.  
  15. Public Class Form1
  16.  
  17.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  18.  
  19.         Dim CurrentFileVersion As String = My.Application.Info.Version.ToString
  20.         Dim NewVersionFile As String = Application.StartupPath & "/version.txt"
  21.         Dim AppFile As String = Application.StartupPath & "/Youtube Updater Tut.exe"
  22.  
  23.         If My.Computer.FileSystem.FileExists(NewVersionFile) Then
  24.             My.Computer.FileSystem.DeleteFile(NewVersionFile)
  25.         End If
  26.  
  27.         My.Computer.Network.DownloadFile("", NewVersionFile)
  28.         Dim ReadVersion As String = My.Computer.FileSystem.ReadAllText(NewVersionFile)
  29.  
  30.         If Not CurrentFileVersion = ReadVersion Then
  31.             MsgBox("Update Available")
  32.             My.Computer.Network.DownloadFile("", AppFile)
  33.             MsgBox("Download Saved In" & Application.StartupPath & AppFile)
  34.         Else
  35.             MsgBox("Program Is Up To Date")
  36.         End If
  37.  
  38.     End Sub
  39. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement