Original Post
Hey all, I'm trying to design an automatic update program for a game project my team is currently working on, and I've run into a bit of a snag.
For some reason the process I have just doesn’t feel right, it more or less has that *hacked* feel. Therefore, I was hoping to get some feedback on the process described below.
**************
Stage 1
* Program startup, scans for .upd files.
* If found .upd file goto Stage 2.
* If no .upd files are found continue.
* Parse local update file (versions.dat)
* Download remote update file (named_folder/remote.dat)
* Check if patch.exe needs to be updated, if so goto Stage 3.
* If patch.exe does not need to update continue.
* (End Stage 3)
* Compare versions of all files on remote list, if file is found on remote but not local, add to update list.
* If number of files to download is greater than zero, continue.
* If number of files to download is zero, end patching process.
* (End Stage 2)
* Start downloading files one by one, all files are stored as .upd files on remote server.
Overwrite any .upd files that exist with the same name.
* When current downloaded file is done, decompress it.
* Once a file is decompressed, validate MD5. If hash is valid, delete .upd and continue. If not, goto (Stage 1 Retry)
Only attempt this 3 times, then prompt user of serious downloading error and to contact Dyaus Entertainment.
* Repeat until all files are finished.
* Replace versions.dat with remote.dat. End patching process.
Stage 2
* Prompt user to contact Dyaus Entertainment if this problem occurs frequently and patching can not be completed.
* Find location of .upd file in remote.dat.
* If .upd file is patch program itself, goto Stage 3.
* Add '.upd' file to update list.
* Compare versions of all files on remote list from there down, if file is found on remote but not local,
add to update list.
* Goto (End Stage 2)
Stage 3
* Prompt user that patcher needs to be updated and it will automatically shutdown and restart program.
* (Stage 3 Retry)
* Download new patch program with .upd extension.
* Decompress patch program with a temporary name.
* Validate MD5. If MD5 is valid, delete .upd and continue. If not, goto (Stage 3 Retry) <-Only attempt this 3 times,
then prompt user of serious downloading error and to contact us.
* Close down current patcher, and delete patch.exe.
* Rename temporary patch program to patch.exe and execute.
* Goto (End Stage 3)
**************
Ok, let me give you a quick overview - a .upd file is a custom single file compression format used to make downloading a bit quicker. Any .dat file listed above is just a simple XML list file that includes the file name, size, and MD5 hash.
Anyway, like I said above I need to streamline it and make it more efficient (Hopefully). So any feedback is more than welcome
Thanks!
Nate S.
[edited by - nstrg on March 10, 2004 1:00:44 PM]