Content Manager

Qui n'a jamais rêvé d'une application qui se met à jour toute seule?

Le développeur prépare son application, qui est dans un dossier.
Lorsqu'il lance l'exe développeur, ça scanne le projet et uploade
en FTP les changements sur un serveur web.

Quand un client lance son application, elle vérifie si elle
est à jour ou pas pour éventuellement se mettre à jour (voir ordinogramme ci-dessous).

Download C source (57.2Ko)

il manque les sources web, le GUI FLTK, ils sont probablement encore dans le moteur 3D
donc à retrouver ou refaire ...


 Basically, as a developer you are working on a project, located inside
 a directory. When you want to release your application to all the clients,
 simply launch the developer exe. It will scan the project folder to detect
 changes, and invite you to upload files on the web server via FTP. Done.

 Next, any client who starts the program will check if the local version
 number is the latest. If not, download the list of files of the latest version,
 and download only files that are more recent, or new. This means all clients
 are using the exact same version.

 Surtout pas d'espace dans les noms de fichiers/dossiers!


 First step : create the list of files, stored in xxx/version/files.
 This list is what clients will request in order to check their local content.
 The content of the file looks like this:

demo/maps/sk8.bsp 1242636520 929868 7a9071276cb3645fb6c66dbbb79d3092
demo/maps/sk8.jpg 1242575742 290159 d03d864b7f43db9ce34df5f720509d0e
demo/maps/ 1242636490 251139 3c0969feb1e22a7794c0fb0143854ace
demo/maps/tools/clean.bat 1242474634 69 86ad0060e2a85a7bd5f5a9b1d69f7e30
demo/maps/tools/ase.bat 1242461706 475 a6ba8dd5e369f8c8095fa8dd7fc64bb1
demo/core.dll 1242843896 291840 82bef32153657dc25dc439a3b500a614
demo/GUI.dll 1241041448 104960 82bef32153657dc25dc439a3b500a614
demo/Irrlicht.dll 1229237360 5831715 82bef32153657dc25dc439a3b500a614
demo/platoon.exe 1242646904 386048 82bef32153657dc25dc439a3b500a614
demo/effects/split.c 1170556454 1174 b66dc3e130fd178fa25f8d082ed161f1
demo/effects/developer.c 1244016362 9819 a5b71066a7d4d853a5725913495f4d72
demo/bx_net.dll 1244225498 9728 82bef32153657dc25dc439a3b500a614
demo/include/HTTP.h 1244229540 2104 51ee3f50fd21766a5cd6512eaab01505
demo/include/TCPsocket.h 1244226398 1767 ff5ee7dfb8ab732c8f477eaead31c621
demo/include/bx_net.h 1244226398 868 3ca04506aefc8a121b2531b28552921e
 Each entry is a folder, or a file.
   * A folder is recognized by the usage of a [ beginning the line.
   * A file entry: Relative path, last modification time, size (bytes), and md5

 Second step : determine what files have been
   (+) added
   (-) removed
   (>) modified
   (=) unchanged


 As the developer of your project, you manage the files on your development
 machine. One folder is monitored by the developer program : this is the
 project folder.
 You do absolutely what you want in the project folder :
 add/remove/modifiy files, everything you want.

 Then, when you want to release yuor project to the all the clients at once,
 you simply launch the developer program. it will search for modifications on
 the project (the operating system stores the timestamp of the last modification
 of a file).
 CMGR-developer.exe does generate or overwrite the xxx/version folder and its
 content, which describe the version.

 When it is done, open your FTP program and rename the xxx/version folder to
 prevent clients from being updated (they'll see the message "please try later")
 then upload files that have been modified locally.

 Endly, upload the version folder onto your HTTP server to indicate to clients
 that a new version is available. Any client who starts the program will get
 the update before launching the main application!


 When a client is launching the application, it connects to the web server to
 get the latest version number. If it is different from the version number
 on disk, then he gets the list of files of the latest version, to compare each
 entry timestamp to the timestamp of the local file, to download it a more
 recent version is available.

 Also an md5 comparison is done by the program just after the download, to be
 sure the file was not corrupted during download. This is good if a download is
 brutally stopped (electricity cut for example), it is not resumed but
 redownloaded entirely.

 When the application is started, the local arborescence is scanned in order
 to detect if some files have been deleted, or modified. If so, the original
 is downloaded from server.

 I think this is good to prevent hacking, a must-have.

 For example if you delete a file by mistake, the program will see it, and
 download automagically the file before launching the application. you won't
 even notice it.

 If a client wants to "reset" and do a full reinstall, he just has to
 delete the version folder. Simple as that. Or delete absolutely everything,
 except the updater.

 That means all clients have the same copy, the latest.

 But the clients can also have custom content, ignored by the updater.

 If someone buys the version 1, then waits six months without using it, the next
 launch it will automatically update to the latest version, say 247 and it will
 be compatible with other clients.
 Moreover I used this example because the client will not download and install
 several updates from version 1 to 247 but it will download directly what it
 needs from the latest version.

 So far this might seem simple, but it is rock solid when it comes to manage
 hundreds of users not having the same files, or using the same network
 protocol : the updater solves all this from start.

 It is cool for users because they can benefit of multiple updates, without
 worrying about what file to download and where to put files... All is done
 automatically, and done fast.


 I wanted the best algorithm, the fatest. The kind of application that does not
 do things that are not needed, like download/overwrite unneeded files, or
 scan the disk without reason. An intelligent application that takes decisions
 depending on the situation.

 Both approaches are done via a library, to make it portable between platforms,
 and to use this middleware to present it with a GUI or 3D application, showing
 a progress bar.