In this post I will explain how Thor checks for new version and distributes tools from VFPx community like GoFish, FoxCharts, FoxyPreviewer, etc. I was involved with Jim Nelson at a pretty low level when all this distribute/update goodness for FoxPro via Thor was first being developed. I have emails dated October 2011 where we were working on this, so 6 years ago as of this post in October 2017.
First, look in the Thor Updates folder of your Thor installation. On my machine the Path is:
C:\Fox\Utils\Thor\Thor\Tools\Updates
In this folder, you will find an updater prg for each tool that is available from Thor. In this case, for the FoxyPreviewer app:
1 |
thor_update_foxypreviewer.prg |
Now, open that file and have a look… In this file, you will see it contains all the info that the Thor update engine uses to check for updates and download a tool.
In this case, the current version that Thor publishes ver ‘v2.99z30’ and it pulls the zip file from this website, which is owned by Rick Schummer, and Jim Nelson (along with a few others I think) have FTP access to this server to post the latest ZIP file.
ZIP location:
1 |
http://vfpxrepository.com/dl/thorupdate/Components/FoxyPreviewer v299z30.zip |
So, to get a tool updated, Jim has to do 2 things:
- Distribute an updated updater prg which will be pulled down when the user from Thor Check For Update. So, he sends out an updated Thor_Update_<<ToolName>>.prg with the new . VersionNumber (or the updater pfg may use a .VersionFileURL property which points to a file on the server which has the new version number) , and a .SourceFileUrl property which has the URL location of a zip file on the server which all the app file in it. Users will see all available updates for any of the Thor distributed apps in the CFU grid.
-
He, or the tool author, must also post the referenced ZIP file to the server (usually an ftp server at a web hosting account) at the URL path referenced in the updater prg.
With these two things in place, lots a black magic happens (or, white magic, since it is Jim, and he is a good fella by most accounts), and users will see that a new update is available, and if Jim has been living right, it will download and unzip to the users local Tools or Components path in the Thor folder.
Here is the code in thor_Update_FoxyPreviewer.prg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
Lparameters loUpdateObject Text to lcRegisterWithThor NoShow TextMerge Messagebox('From the Thor menu, see "More -> Open Folder -> Components"', 0 ,"FoxBarCode installed", 5000) EndText lcRegisterWithThor = Strtran(lcRegisterWithThor, '@@@') With loUpdateObject .ApplicationName = 'FoxyPreviewer' .Component = 'Yes' .VersionLocalFilename = 'FoxyPreviewerVersionFile.txt' .RegisterWithThor = lcRegisterWithThor .VersionNumber = 'v2.99z30' && this must be character! .VersionDate = Date(2013, 9, 23) && this avoids date formatting issues .ProjectCreationDate = Date(2014, 3, 24) .SourceFileUrl = 'http://vfpxrepository.com/dl/thorupdate/Components/FoxyPreviewer v299z30.zip' .Link = 'https://foxypreviewer.codeplex.com/' .LinkPrompt = 'FoxyPreviewer Home Page' .Notes = GetNotes() Endwith Return loUpdateObject Procedure GetNotes Local lcNotes Text to lcNotes NoShow Export your Visual FoxPro reports to Images, RTF, PDF, HTML or XLS super easy! Send them by email! Enhance the look of your previews, and allow your users to decide how their report previews will be. EndText Return lcNotes EndProc |