Wednesday, 23 February 2011

Updater - Part II

Yesterday I told you that NaroCAD will only download the files that were changed during the new release. Although I encountered problem with checking the file length, the hash code was a bit tricky. The main problem is that the hash code had different values depending on the time the file was created, and other parameters.

The main problem was that every build changed the hash code of the project files. The only solution to this problem would be to study how the date information is stored in files, study the encryption and decide whether the new file has useful information or not. Still, we mustn’t forget that the size of these files is small (very small if compressed). Even if I were to study these changes, I would still have to download the file in order to do the analysis. Even more, the analysis would be time consuming. The best way is to download all the generated files and check if changes were made to all the other files. This is a bit easier because these files don’t suffer from small changes, usually no changes at all. Given that the files without such problems are more than 70% of all NaroCAD files, the updater will prove much faster than actually downloading and installing NaroCAD.

To tell the truth, even the other files have different hash code when created by the installer. The advantage is that building the projects will not change these files. This means that the developers will not store different hash code for these files when generating the information of the versioning files. If these files are changed, the information from the versioning files will also change. Knowing this helps me to implement a faster updater. The only trick is that the newer hash code of these files (for example OpenCascade libraries, icons, etc) will be compared with the hash code from the current versioning files. This way, the contents of these files will not be red. What does this mean? If someone changes a character of such a file on purpose (so that the length remains the same) the updater will not be able to tell the difference.

So, to make it brief: the files generated by the NaroCAD projects will always be replaced in the new versions, and all other files will be downloaded only if needed.

No comments:

Post a Comment