How to add the auto-updating function to the visual basic mu-online launcher
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
http://imagenic.net/images/dfdqo9ome...orwg_thumb.png
2)Make a New Project
http://imagenic.net/images/50bwlm6jk...ktku_thumb.png
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]
http://imagenic.net/images/lbbkhr5g6...osxt_thumb.png
4) Edit the buttons code, and add :
Code:
Process.Start("main.exe")
Of course change the main.exe to what's your executable's name.
http://imagenic.net/images/im53myyg5svpwiq40t_thumb.png
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.
http://imagenic.net/images/31wc83bmy...z5xp_thumb.png
http://imagenic.net/images/eos4xzd9o...pzv0_thumb.png
http://imagenic.net/images/c3zostkhn...li1v_thumb.png
6)Double click on the form itself [OPTIONAL : YOU CAN MAKE A BUTTON DO THIS!!]
And add :
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
7) Put this under that current sub :
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
http://imagenic.net/images/nyxjyhpjv...9vj7_thumb.png
http://imagenic.net/images/suvboc4mf...7eq9_thumb.png
http://imagenic.net/images/hik2ndsuq...9uxl_thumb.png
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 :)
1 Attachment(s)
Re: How to add the auto-updating function to the visual basic mu-online launcher
How to do this with VB 2010 Express?
Well, WebClient1 = WebBrowser1, right? Then next error on "DownloadFile", not recognized. Same with ZipFile and Zip, check screen-shot below.
Attachment 107313
Re: How to add the auto-updating function to the visual basic mu-online launcher
for better explanation please insert images or video.
Thanks..
Re: How to add the auto-updating function to the visual basic mu-online launcher
That is for me? There is an image! :)
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
Krims
That is for me? There is an image! :)
no no not you sir.... uhmmmm... the author.
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
Krims
How to do this with VB 2010 Express?
Well, WebClient1 = WebBrowser1, right? Then next error on "DownloadFile", not recognized. Same with ZipFile and Zip, check screen-shot below.
Attachment 107313
Visual Basic Code Snippet - Download File from URL
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
Krims
How to do this with VB 2010 Express?
Well, WebClient1 = WebBrowser1, right? Then next error on "DownloadFile", not recognized. Same with ZipFile and Zip, check screen-shot below.
Attachment 107313
The one with the webclient - add it on the toolbox.
And the zip : I'm editting the code - found an error :)
Re: How to add the auto-updating function to the visual basic mu-online launcher
.StartInfo.FileName = "D:\Program Files\WinZip\winzip32.exe "
And if someone have different location or different archiver?
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
Krims
.StartInfo.FileName = "D:\Program Files\WinZip\winzip32.exe "
And if someone have different location or different archiver?
Good question, ill add that in a moment.
And about the archiver, rar and zip are compatible with one-another, that includes tar.
Done as requested my friend :)
Re: How to add the auto-updating function to the visual basic mu-online launcher
can you add with progress bar?
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
royaljourney
can you add with progress bar?
Not recommended, but if you do, you'll hardly see it stop moving from time to time, cause the commands are really fast.
But if you want to :
Add between codes this :
ProgressBar1.Value = ProgressBar1.Value + 10
Only 10 TIMES! or +5 For 20, +1 for 100 and so on...
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
NoamRodrik
Not recommended, but if you do, you'll hardly see it stop moving from time to time, cause the commands are really fast.
But if you want to :
Add between codes this :
ProgressBar1.Value = ProgressBar1.Value + 10
Only 10 TIMES! or +5 For 20, +1 for 100 and so on...
Sorry if I have request, I want launcher with Progress bar for some add design of the launcher
Re: How to add the auto-updating function to the visual basic mu-online launcher
Quote:
Originally Posted by
royaljourney
Sorry if I have request, I want launcher with Progress bar for some add design of the launcher
No problem, has your request been achieved as you wanted it to be?
Re: How to add the auto-updating function to the visual basic mu-online launcher
Sir Noam I have noob question, What version of visual basic that you use for this code?
Re: How to add the auto-updating function to the visual basic mu-online launcher
Visual Basic .net Till Visual Basic 2011