Real Software Forums
http://forums.realsoftware.com/

Update checker
http://forums.realsoftware.com/viewtopic.php?f=21&t=35893
Page 3 of 3

Author:  Bimal [ Fri Aug 17, 2012 7:01 am ]
Post subject:  Re: Update checker

Hi All,
Can anyone tell me to why this line is not working.............

updateversion = h.get(VersionURL, 5) // get the lines



VersionUrl = [url]"http://Localhost/TestFolder/Version.txt"[/url]


when i am checking the h.httpstatuscode then it returns 102.

Please tell me

Author:  tseyfarth [ Wed Feb 13, 2013 11:51 pm ]
Post subject:  Re: Update checker

Hello all,

Very interesting thread. Are there any code updates available?

Thank you,
Tim

Author:  DaveS [ Thu Feb 14, 2013 1:05 am ]
Post subject:  Re: Update checker

here is how I do it
#If Not DebugBuild
#pragma DisableBackgroundTasks
#pragma DisableBoundsChecking
#pragma DisableAutoWaitCursor
#pragma StackOverflowchecking False
#pragma NilObjectChecking False
#EndIf
Dim http As New classHTTPSocket
Dim i As Integer
Dim s As String
Dim v(-1) As String
Dim d As New MessageDialog
Dim b As MessageDialogButton
Dim f As FolderItem
Dim isMounted As Boolean
Dim mount_msg As String
Dim Update_Status As Integer
Dim download_site As String
Dim file_fmt As String
mount_msg=""
isMounted=False

download_site=web_download_site

// Assumptions :
//
// winMAIN is the name of the window to show this dialog in.
//
// you have a subclass of HTTPSocket called classHTTPSocket [see above]
//
// there are global variables in the application
// pgm_name - descriptive name of the app
// pgm_version - String with current version # [ie. s="0.22"]
//
// a global procedure called "msgNeedtoSave" which checks if any changes need to be saved first
//
// your server has two files at the web address above
// a) xxx.dmg - dmg file with new version of code in it
// b) xxx.ver - one line text file [see below for format]
//
For i=0 To VolumeCount-1
If Volume(i).DisplayName=pgm_name Then
isMounted=True
mount_msg=Chr(13)+Chr(13)+"'"+pgm_name+"' is already mounted on your desktop, please"+Chr(13)+"eject this file and try again."
Exit For
End If
Next i

d.icon=MessageDialog.GraphicNote
d.ActionButton.Visible=True
d.ActionButton.Caption="Ok"
d.CancelButton.Visible=False
d.AlternateActionButton.Visible=False
http.Yield=True
s=http.Get(Lowercase(download_site+pgm_name+".ver"),4)
Update_Status=0
If s<>"" Then
// format xx.xx mm/dd/yyyy ZIP
// version and date uploaded
v=Split(s," ")
v(0)=Str(CDbl(v(0)))
file_fmt="DMG"
If CDbl(v(0))>0 Then
If CDbl(v(0))=CDbl(Pgm_Version) Then Update_Status=1
If CDbl(v(0))>CDbl(Pgm_Version) Then Update_Status=2
If CDbl(v(0))<CDbl(Pgm_Version) Then Update_Status=3
Else
Update_Status=-1
If v.Ubound=1 Then Update_Status=1
End If
Else
Update_Status=-1
End If
If v.Ubound>1 Then file_fmt=v(2)
'

Select Case Update_Status
Case -1
d.icon=MessageDialog.GraphicCaution
d.message="Unable to connect to remote server"
d.explanation="In order to obtain current version information"+Chr(13)+download_site+pgm_name+".ver"
Case 1
d.message="You are up to date..."
d.Explanation=Pgm_Name+" v"+Pgm_Version+" is currently the latest version available."
If Not notify Then Update_Status=0
Case 2
d.Message="An update to "+Pgm_Name+" is available"
d.explanation="You currently have "+Pgm_Version+" and "+v(0)+" was made"+Chr(13)+"available on "+v(1)+mount_msg+Chr(13)+"Download file is in "+file_fmt+" format."
If Not isMounted Then
d.CancelButton.Visible=True
d.CancelButton.Caption="View Release Notes"
d.AlternateActionButton.Visible=True
d.AlternateActionButton.Caption="Download version "+v(0)
d.ActionButton.Visible=True
d.ActionButton.Caption="Skip it for now"
End If
Case 3
d.Message="Somebody screwed up...."
d.explanation="You currently have "+Pgm_Version+", but the Server has version "+v(0)+" made on "+v(1)
d.ActionButton.Caption="Oops"
If Not notify Then Update_Status=0
End Select

If Update_Status<>0 Then
b=d.ShowModalwithin(winMAIN)
Select Case b
Case d.ActionButton
'exit sub
Case d.AlternateActionButton
/////winMAIN.lblDOWNLOAD.Visible=true
/////winMAIN.lblDOWNLOAD.Invalidate
s=Lowercase(pgm_name+"."+file_fmt)
f=SpecialFolder.Desktop.Child(s) // saves the file on Desktop
If f.exists Then f.Delete
http.Yield=False
s=Lowercase(download_site+s)
http.get (s,f) //downloading file to desktop

Case d.CancelButton
//user pressed Cancel
// View Release Notes
/////ShowURL web_release_notes
End Select
End If

Author:  tseyfarth [ Fri Feb 15, 2013 10:57 pm ]
Post subject:  Re: Update checker

Thanks Dave!
Tim

Page 3 of 3 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/