views:

617

answers:

4

Hi, I am working on a simple FOSS VB.net program that operates mostly in one window( http://code.google.com/p/slotshuffle/ link if anyone would like to help review the code or or wants to see for reference).

I have searched online for ways to notify users of an updated version, and most of them involve changing the method of deployment or adding a lot of classes (to a program that's only 500-odd lines including comments).

What I would like to be able to do (in pseudo code) is go to a file menu or button(ie a sub) and:

if http://(website...)/slotshuffle2.0.zip exists
then
msgBox.show "New version available" + a link
else
msgBox.show "No new version check back later"

It seems like there is a .exists method that can be used locally, but I am not quite sure if it is applicable here? Also has anyone had experience with update checks and googlecode? (i.e. is the address formed in a predictable manner such that what I am asking is feasible?)

+1  A: 

The first thing to point out is MsgBox will not show a hyperlink under any circumstances. You have to have your own form for that.

For the actual question of how to check for a file on the web, you want to use the System.Net.WebClient class. That will allow you to easily download a file from the web.

Or, use the System.Net.HttpWebRequest class to create a request for a file. This is a little more complicated to use, but will allow you to request the file and get a response from the server without actually downloading the entire thing.

Joel Coehoorn
This is an interesting idea as well, I'm going to have to investigate more, maybe for a future release. Thanks for the quick response!
Chromableed Studios
+1  A: 

If i were you the way i would do it is have a currentversion.html page on the site containing the current version number, then if you use a webrequest, described here http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx you can find that version, compare to the version of the client, then do what you need from there.

John Boker
Didn't follow your suggestion exactly, but you got me thinking with the currentversion.html >>> Ended up just adding a webbrowser component and linking to the google code wiki!Thanks to everyone that replied, Love this site!
Chromableed Studios
why didnt you mark him up ?
I__
A: 

I have done something similar, although it just reads a URL for text and strips out the information I need with regex:

System.Net.WebClient().DownloadString(oURL).Split(Chr(10))

I then loop through the resulting array (of lines) and process the information.

Maybe this can get you started

Anders
+1  A: 

If you know for sure that the file exists, you can check the IfModifiedSince property.

For this, you will have to store the last modified date after you have downloaded the first version & on subsequent checks, compare the file modified date with the stored date.

See the MSDN link above for an example.

shahkalpesh