Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Aug 21, 2017 5:15 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Update checker
PostPosted: Fri Aug 17, 2012 7:01 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Update checker
PostPosted: Wed Feb 13, 2013 11:51 pm 
Offline

Joined: Sat Dec 04, 2010 9:14 pm
Posts: 918
Hello all,

Very interesting thread. Are there any code updates available?

Thank you,
Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: Update checker
PostPosted: Thu Feb 14, 2013 1:05 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Update checker
PostPosted: Fri Feb 15, 2013 10:57 pm 
Offline

Joined: Sat Dec 04, 2010 9:14 pm
Posts: 918
Thanks Dave!
Tim


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group