本文整理汇总了C#中Chorus.merge.xml.generic.XmlMerger类的典型用法代码示例。如果您正苦于以下问题:C# XmlMerger类的具体用法?C# XmlMerger怎么用?C# XmlMerger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlMerger类属于Chorus.merge.xml.generic命名空间,在下文中一共展示了XmlMerger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoMerge
internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
{
XmlNode ours;
XmlNode theirs;
XmlNode common;
DoPreMerge(mergeOrder, out ours, out theirs, out common);
var results = merger.Merge(ours, theirs, common);
DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
}
示例2: CreateXmlMergerForFieldWorksData
internal static XmlMerger CreateXmlMergerForFieldWorksData(MergeOrder mergeOrder, MetadataCache mdc)
{
var merger = new XmlMerger(mergeOrder.MergeSituation)
{
EventListener = mergeOrder.EventListener
};
BootstrapSystem(mdc, merger);
return merger;
}
示例3: FixtureSetup
public void FixtureSetup()
{
_mdc = MetadataCache.TestOnlyNewCache;
var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation())
{
EventListener = new ListenerForUnitTests()
};
_merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, _mdc);
}
示例4: ChorusNotesAnnotationMergingStrategy
/// <summary>
/// Produce a string that represents the 3-way merger of the given three elements.
/// </summary>
public ChorusNotesAnnotationMergingStrategy(MergeOrder order)
{
_annotationMerger = new XmlMerger(order.MergeSituation)
{
EventListener = order.EventListener
};
SetupElementStrategies();
}
示例5: Do3WayMerge
public void Do3WayMerge(MetadataCache mdc, MergeOrder mergeOrder)
{
var merger = new XmlMerger(mergeOrder.MergeSituation)
{
EventListener = mergeOrder.EventListener
};
CustomLayoutMergeStrategiesMethod.AddElementStrategies(merger.MergeStrategies);
CustomLayoutMergeService.DoMerge(mergeOrder, merger);
}
示例6: LiftEntryMergingStrategy
/// <summary>
/// Produce a string that represents the 3-way merger of the given three elements.
/// </summary>
public LiftEntryMergingStrategy(MergeOrder mergeOrder)
{
_entryMerger = new XmlMerger(mergeOrder.MergeSituation)
{
MergeStrategies = {ElementToMergeStrategyKeyMapper = new LiftElementToMergeStrategyKeyMapper()},
EventListener = mergeOrder.EventListener
};
LiftElementStrategiesMethod.AddLiftElementStrategies(_entryMerger.MergeStrategies);
}
示例7: DoMerge
internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
{
XmlNode ours;
XmlNode theirs;
XmlNode common;
DoPreMerge(mergeOrder, out ours, out theirs, out common);
// The document element is being returned here, so our parent isn't relevant and won't be used by the merge
var results = merger.Merge(null, ours, theirs, common);
DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
}
示例8: TestSetup
public override void TestSetup()
{
base.TestSetup();
Mdc.UpgradeToVersion(MetadataCache.MaximumModelVersion);
var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation())
{
EventListener = new ListenerForUnitTests()
};
_merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, Mdc);
}
示例9: LiftRangesMergingStrategy
/// <summary>
/// Constructor
/// </summary>
public LiftRangesMergingStrategy(MergeOrder mergeOrder)
{
_merger = new XmlMerger(mergeOrder.MergeSituation)
{
EventListener = mergeOrder.EventListener
};
LiftBasicElementStrategiesMethod.AddLiftBasicElementStrategies(_merger.MergeStrategies);
LiftRangesElementStrategiesMethod.AddLiftRangeElementStrategies(_merger.MergeStrategies);
}
示例10: GetStrategies
/// <summary>
/// Gets the collection of element merge strategies.
/// </summary>
public MergeStrategies GetStrategies()
{
var merger = new XmlMerger(new MergeSituation(null, null, null, null, null, MergeOrder.ConflictHandlingModeChoices.WeWin));
var def = new ElementStrategy(true)
{
MergePartnerFinder = new FindByEqualityOfTree()
};
merger.MergeStrategies.SetStrategy("def", def);
return merger.MergeStrategies;
}
示例11: ChildOrderer
internal ChildOrderer(List<XmlNode> primary, List<XmlNode> others, Dictionary<XmlNode, XmlNode> correspondences,
XmlMerger merger, ChildOrder parentOrder)
{
_primary = primary;
_others = others;
_correspondences = correspondences;
_positions = new PositionRecord[others.Count];
Debug.Assert(merger != null);
_merger = merger;
_parentOrder = parentOrder;
}
示例12: AllHadProperty_ButNothingElse
public void AllHadProperty_ButNothingElse()
{
const string commonAncestor =
@"<Lexicon>
<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
<Etymology>
</Etymology>
</LexEntry>
</Lexicon>";
const string ours =
@"<Lexicon>
<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
<Etymology>
</Etymology>
</LexEntry>
</Lexicon>";
const string theirs =
@"<Lexicon>
<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
<Etymology>
</Etymology>
</LexEntry>
</Lexicon>";
var listener = new ListenerForUnitTests();
var merger = new XmlMerger(new NullMergeSituation())
{
EventListener = listener
};
merger.MergeStrategies.SetStrategy("Lexicon", ElementStrategy.CreateSingletonElement());
var strat = ElementStrategy.CreateForKeyedElement("guid", false);
strat.AttributesToIgnoreForMerging.Add("guid");
merger.MergeStrategies.SetStrategy("LexEntry", strat);
strat = ElementStrategy.CreateSingletonElement();
strat.NumberOfChildren = NumberOfChildrenAllowed.ZeroOrOne;
merger.MergeStrategies.SetStrategy("Etymology", strat);
strat = ElementStrategy.CreateForKeyedElement("guid", false);
strat.AttributesToIgnoreForMerging.Add("guid");
merger.MergeStrategies.SetStrategy("LexEtymology", strat);
XmlTestHelper.DoMerge(merger.MergeStrategies, merger.MergeSituation,
commonAncestor, ours, theirs,
new[] { "Lexicon/LexEntry/Etymology" },
null,
0, new List<Type>(),
0, new List<Type>());
}
示例13: AddConflictToListener
/// <summary>
/// Add conflict. If RecordContextInConflict fails to set a context, and nodeToFindGeneratorFrom is non-null,
/// attempt to add a context based on the argument.
/// </summary>
public static void AddConflictToListener(IMergeEventListener listener, IConflict conflict, XmlNode oursContext,
XmlNode theirsContext, XmlNode ancestorContext,
IGenerateHtmlContext htmlContextGenerator, XmlMerger merger, XmlNode nodeToFindGeneratorFrom)
{
// NB: All these steps are crucially ordered.
listener.RecordContextInConflict(conflict);
if ((conflict.Context == null || conflict.Context is NullContextDescriptor) && nodeToFindGeneratorFrom != null)
{
// We are too far up the stack for the listener to have been told a context.
// Make one out of the current node.
conflict.Context = merger.GetContext(nodeToFindGeneratorFrom);
}
conflict.MakeHtmlDetails(oursContext, theirsContext, ancestorContext, htmlContextGenerator);
listener.ConflictOccurred(conflict);
}
示例14: MergeTextNodesMethod
/// <summary>
/// This is for regular three-way merges.
/// </summary>
public MergeTextNodesMethod(XmlMerger merger, IElementDescriber elementDescriber,
HashSet<XmlNode> skipInnerMergeFor,
ref XmlNode ours, List<XmlNode> ourKeepers,
XmlNode theirs, List<XmlNode> theirKeepers,
XmlNode ancestor, List<XmlNode> ancestorKeepers)
{
_ours = ours;
_ourKeepers = ourKeepers;
_theirs = theirs;
_theirKeepers = theirKeepers;
_ancestor = ancestor;
_ancestorKeepers = ancestorKeepers;
_merger = merger;
_elementDescriber = elementDescriber;
_skipInnerMergeFor = skipInnerMergeFor;
}
示例15: BootstrapSystem
/// <summary>
/// Bootstrap a merger for the new-styled (nested) files.
/// </summary>
/// <remarks>
/// 1. A generic 'header' element will be handled, although it may not appear in the file.
/// 2. All classes will be included.
/// 3. Merge strategies for class properties (regular or custom) will have keys of "classname+propname" to make them unique, system-wide.
/// </remarks>
private static void BootstrapSystem(MetadataCache metadataCache, XmlMerger merger)
{
merger.MergeStrategies.ElementToMergeStrategyKeyMapper = new FieldWorksElementToMergeStrategyKeyMapper();
var sharedElementStrategies = new Dictionary<string, ElementStrategy>();
CreateSharedElementStrategies(sharedElementStrategies);
var strategiesForMerger = merger.MergeStrategies;
ContextGen.MergeStrategies = strategiesForMerger;
foreach (var sharedKvp in sharedElementStrategies)
strategiesForMerger.SetStrategy(sharedKvp.Key, sharedKvp.Value);
var customPropDefnStrat = new ElementStrategy(false)
{
MergePartnerFinder = new FindByMultipleKeyAttributes(new List<string> { SharedConstants.Name, SharedConstants.Class }),
ContextDescriptorGenerator = new FieldWorksCustomPropertyContextGenerator(),
IsAtomic = true,
NumberOfChildren = NumberOfChildrenAllowed.Zero
};
strategiesForMerger.SetStrategy(SharedConstants.CustomField, customPropDefnStrat);
var headerStrategy = CreateSingletonElementType(false);
headerStrategy.ContextDescriptorGenerator = ContextGen;
strategiesForMerger.SetStrategy(SharedConstants.Header, headerStrategy);
// There are two abstract class names used: CmAnnotation and DsChart.
// Chorus knows how to find the matching element for these, as they use <CmAnnotation class='concreteClassname'.
// So, add a keyed strategy for each of them.
var keyedStrat = ElementStrategy.CreateForKeyedElement(SharedConstants.GuidStr, false);
keyedStrat.AttributesToIgnoreForMerging.Add(SharedConstants.Class);
keyedStrat.AttributesToIgnoreForMerging.Add(SharedConstants.GuidStr);
strategiesForMerger.SetStrategy(SharedConstants.CmAnnotation, keyedStrat);
keyedStrat = ElementStrategy.CreateForKeyedElement(SharedConstants.GuidStr, false);
keyedStrat.AttributesToIgnoreForMerging.Add(SharedConstants.Class);
keyedStrat.AttributesToIgnoreForMerging.Add(SharedConstants.GuidStr);
strategiesForMerger.SetStrategy(SharedConstants.DsChart, keyedStrat);
foreach (var classInfo in metadataCache.AllConcreteClasses)
{
MakeClassStrategy(strategiesForMerger, classInfo, ContextGen);
AddPropertyStrategiesForClass(strategiesForMerger, classInfo);
}
}