Game Development Reference
In-Depth Information
In Chapter 19, “Implementing a Checksum to Protect Data Integrity,” an algorithm
was discussed that generated a number based on the byte values in a memory
buffer. This value can be used to detect file corruption and tampering. The same
technique can also be used to be certain the file we are trying to patch is the correct
one.
A checksum can be generated based on the source file and then serialized into the
difference list. When a file is selected to be patched, you can generate a checksum
for it, and only patch the file if the generated checksum matches the value saved in
the difference list.
Employing this method of file verification solves a couple of issues. The obvious
reason is to stop users from patching the wrong files, thus preventing the algo-
rithm flaw discussed previously. Another benefit of using a checksum is that any
files transmitted over the Internet can be verified for integrity.
Aside from source file verification, a reliable distribution system must also be in
place so that users have access to the latest patch files for the software product. As
previously discussed, an excellent transport medium for software updates is the
Internet. A front end could query for the latest version, download the latest patch,
and apply it to an older version of the product.
Compression could also be used on the binary data, which would be a great
enhancement to the patching system because the resultant data size would be
decreased even more. .NET 2.0 introduced the System.IO.Compression namespace
that can accomplish this.
Lastly, another consideration for update generation is the modular structure of
your software. For example, if your software has external modules or assemblies
that are linked into the application at runtime, any updates specific to that library
can be issued in a patch specific to just that file. If you have any modules of code
that will change quite often, a general rule of thumb would be to place them in an
external library and run updates against that file alone.
Conclusion
Aside from building your own patch generator, some third-party tools are readily
available to do the job for you as well. Microsoft InstallShield is one of these tools
that will automatically build an update between two versions of data and offer a
method of transitioning between them. Another excellent deployment tool intro-
duced with .NET 2.0 is ClickOnce; be sure to check it out.
Search Nedrilad ::




Custom Search