Well, I think you've seen the other tutorial of how to make a simple launcher.
But, you will need much more than that for a launcher that will be efficient to handle a server.
So, on with the tutorial.
This tutorial is compatible with Visual Basic 2005-2011 [Not that sure of 2005].
1)Open Visual Basic
2)Make a New Project
3)Edit the form's interface with your own creational needs,
The form must include :
2 Buttons :
1 Button [Startup button]
1 Update Button [OPTIONAL - MAY USE THE LOADING FORM FUNCTION]
1 Webclient [NOT NEEDED IN THE TOOLBOX! BUT IN THIS TUT IT'LL BE IN THE TOOLBOX]
4) Edit the buttons code, and add :
Of course change the main.exe to what's your executable's name.Code:Process.Start("main.exe")
5)Add to your website a folder called [Update] and 3 Files in it, [UP1.txt],[DN1.txt] (MAKE THEM BOTH 1 [Inside text]),
and a file called Extract.Zip in it, all what you want to update.
6)Double click on the form itself [OPTIONAL : YOU CAN MAKE A BUTTON DO THIS!!]
And add :
7) Put this under that current sub :Code:dim dn1 as integer dim up1 as integer WebClient1.DownloadFile("YOURWEBSITE.COM/Update/dn1.txt","DN1.TXT") WebClient1.DownloadFile("YOURWEBSITE.COM/Update/up1.txt","UP1.TXT") dn1 = My.Computer.FileSystem.ReadAllText("dn1.txt") up1 = My.Computer.FileSystem.ReadAllText("up1.txt") if dn1 > up1 then WebClient1.DownloadFile("YOURWBSITE.COM/EXTRACT.ZIP","extract.zip") ZipFiles("extract.zip") My.Computer.FileSystem.WriteAllText("DN1.TXT",dn1,false) end if
Code:Function ZipFiles (Byval strFileName as String) If My.Computer.FileSystem.FileExists(strFileName) Then Dim p As New Process With p .StartInfo.Arguments = "-min -e " & strFileName & "\" End With If My.Computer.FileSystem.FileExists("D:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "D:\Program Files\WinZip\winzip32.exe" ElseIf My.Computer.FileSystem.FileExists("C:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "C:\Program Files\WinZip\winzip32.exe" ElseIf My.Computer.FileSystem.FileExists("E:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "E:\Program Files\WinZip\winzip32.exe" ElseIf My.Computer.FileSystem.FileExists("F:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "F:\Program Files\WinZip\winzip32.exe" ElseIf My.Computer.FileSystem.FileExists("G:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "G:\Program Files\WinZip\winzip32.exe" ElseIf My.Computer.FileSystem.FileExists("H:\Program Files\WinZip\winzip32.exe") Then p.StartInfo.FileName = "H:\Program Files\WinZip\winzip32.exe" Else Msgbox("Or WinZip isn't installed, please install it, Or You have infinite hard disk drives...") Application.Exit() End If p.Start() Else MessageBox.Show(strFileName & " Not found ", "File Note found", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Return 0 End Function
EDIT :
Got a couple of requests asking me how to use it, so the answer is :
Put your files inside the Extract.zip in your website,
And when you want to update, just put Up1.txt Bigger than Dn1.txt.
You got Your own auto-updating launcher.
I didn't really test this code, so any errors report it to me and i'll fix it :)



Reply With Quote



