Class TuningMerge
- Namespace
- LlamaLogic.TuningArchive
- Assembly
- LlamaLogic.TuningArchive.dll
Merges a mod's changes to a tuning onto the game's new version of it: a three-way merge of the version the mod was made from (the base), the mod's version, and the game's new version
public static class TuningMerge
- Inheritance
-
TuningMerge
- Inherited Members
Remarks
Elements are matched by name (the element of a variant by the variant's option), and list items are aligned, so that a changed item is not mistaken for one removed and another added: items are the same item when their XML is the same, or, for items with members, when at least half of their values are.
Where only one side changed an element, the merge takes that side's version. Where both changed it differently, or one removed an item the other changed, that is a conflict, resolved as the caller says (by default, the game's version). Items both sides added at the same place are all kept, the game's first, and an item both added is kept once (where the mod put it, if they put it in different places). Attributes merge the same way, so a change the mod made to the root element's attributes is kept.
Methods
Merge(string, string, string, Func<TuningMergeConflict, TuningMergeChoice>?)
Merges the changes the mod made in modText to baseText onto gameText, resolving each conflict as resolve says (by default, the game's version)
public static TuningMergeResult Merge(string baseText, string modText, string gameText, Func<TuningMergeConflict, TuningMergeChoice>? resolve = null)
Parameters
baseTextstringThe version of the tuning the mod was made from
modTextstringThe mod's version of the tuning
gameTextstringThe game's new version of the tuning
resolveFunc<TuningMergeConflict, TuningMergeChoice>Chooses a side for each conflict, or null to take the game's version every time