Thursday, February 24, 2011
Updater - Part III
I managed to solve all the problems related to downloading the needed files. The main problem was that I made too many tests after downloading the files, so many that the integrity of files was never ok. I also made a cool trick while fixing these problems. NaroCAD will not only download the newer files, but will also check if the current files are still valid. Because I couldn’t use the hash code for many of the files, I checked the file lengths (in case they even exist on disk). What does this mean? Let’s say that the user “accidentally” deletes the help files, some NaroCAD icons, and more. If NaroCAD needs update and still has enough files to start, the update will verify that even the unchanged files still exist on disk and that they have the correct size. This way, the updater will automatically download those files for you, and will fix and update NaroCAD at the next start-up. Even if you have the latest version, and “accidentally” delete some files that are not critical to NaroCAD at start-up, just change the version number from the Version file to a lower one. NaroCAD will try an update and will heal itself :) Don’t worry if the internet connection is lost during that process. NaroCAD will try again at the next start-up, not from scratch, but it will continue from where it had left off.