Posted about 1 year ago, by Jordan

Hey guys, today I'll try to teach you how to do a really basic "auto update" type thing.

First off, this script does not automatically download the file, but checks its versioning and prompts the user.

 

First of all, this is a function that i use to open a file, and read its contents.

 

Fairly straightforward stuff. Just reads an entire file.

We dim wc as a new System.Net.WebClient, ver as an array, and runupdate as Boolean.

We check if the version file exists, if so, delete it.

Then we download the new file.

I just threw the while in there just incase it wasn't as instant as i'd hope.

 

Then we split the version information up.

 

Now, this is the part i like, where we detect the version of our client, and compare that to the server.

Just rememeber to change the string when you decide to use this!!

 

Then, finally, we detect if RunUpdate has been set to true, if so, we update!

 

Now, in the form load section of your application, (Possibly) after all this code. We would have something to detect the client name and update accordingly.

As you can see, if its the real client, we delete newclient.exe, else if its a differentname, such as 'newclient.exe', it will delete the orignal, and copy itself over it. Which in turn, will delete the newclient.exe

 

I hope somebody found this helpful!

Please leave a comment if you have any questions.

Author Info Comment