Game Development Reference
In-Depth Information
System.Collections.Generic.List<byte> is an excellent choice to store the resultant
data because it has many methods that allow for inserting and deleting a range of
elements at a specific index.
The functions in the following code illustrate the process described in the preced-
ing text for transforming data using the difference list.
public byte[] MergeDifferences(PatchDifferenceData[] differenceData)
The source code for this method is available on the Companion Web site.
private List<byte> MergeDifferencePass(PatchDifferenceData[] differenceData,
List<byte> result,
PatchDifferenceType type)
The source code for this method is available on the Companion Web site.
After applying the preceding changes, the old data should have been correctly
transformed into the new data. The Companion Web site shows an example XML
document of how a transformation sequence can look.
Thoughts for Usability and Deployment
A major fault with the algorithm discussed occurs when the source and target files
are hardly similar, and very few duplicate byte sequences are found. This leads to
many recursion and comparison calls. This algorithm works great on datasets that
have a lot of similarities because large sequential patterns allow us to ignore pro-
cessing them, but this is very slow in the opposite situation.
One method of preventing this issue is to make sure that both files selected are
modifications of each other. This is hard to detect when building a patch, but after
the patch is created, you can add in a pretty decent failsafe.
Search Nedrilad ::

Custom Search