当前位置: 首页>>代码示例>>C#>>正文


C# merge.MergeOrder类代码示例

本文整理汇总了C#中Chorus.merge.MergeOrder的典型用法代码示例。如果您正苦于以下问题:C# MergeOrder类的具体用法?C# MergeOrder怎么用?C# MergeOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MergeOrder类属于Chorus.merge命名空间,在下文中一共展示了MergeOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BothModifiedExampleFormTextWorksWithConflict

        public void BothModifiedExampleFormTextWorksWithConflict()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"This is my example", @"It's mine don't touch it.");

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.AreEqual(1, listener.Conflicts.Count);
                var warning = listener.Conflicts[0];
                Assert.AreEqual(typeof(XmlTextBothEditedTextConflict), warning.GetType(), warning.ToString());
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example/form");
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:35,代码来源:ExampleSentenceMergingTests.cs

示例2: BothAddedHeaderButWithDifferentContentInEach

        public void BothAddedHeaderButWithDifferentContentInEach()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='parent' guid='c1ed1fa3-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form parent</text>
                                </form>
                            </lexical-unit>
                         </entry>
                    </lift>";
            var alpha = ancestor.Replace("<entry id", "<header><description>alphastuff</description></header><entry id");
            var beta = ancestor.Replace("<entry id", "<header><ranges>betastuff</ranges></header><entry id");

            using (var oursTemp = new TempFile(alpha))
            using (var theirsTemp = new TempFile(beta))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry",
                    "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.IsTrue(result.Contains("<header>"));
                Assert.IsTrue(result.Contains("<description>"));
                Assert.IsTrue(result.Contains("<ranges>"));
                listener.AssertExpectedChangesCount(2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:34,代码来源:FileLevelMergeTests.cs

示例3: OneAddedOneTranslationOtherEditedFormText

        public void OneAddedOneTranslationOtherEditedFormText()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"</example>", @"<form lang='en'><text>hello new entry</text></form></example>");

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example");
                AssertThatXmlIn.String(result).HasSpecifiedNumberOfMatchesForXpath("//example/form", 2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:33,代码来源:ExampleSentenceMergingTests.cs

示例4: Do3WayMerge

 public void Do3WayMerge(MergeOrder order)
 {
     XmlMergeService.Do3WayMerge(order,
         new ChorusNotesAnnotationMergingStrategy(order),
         false,
         null,
         "annotation", "guid");
 }
开发者ID:sillsdev,项目名称:chack,代码行数:8,代码来源:ChorusNotesFileHandler.cs

示例5: FixtureSetup

		public void FixtureSetup()
		{
			_mdc = MetadataCache.TestOnlyNewCache;
			var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation())
			{
				EventListener = new ListenerForUnitTests()
			};
			_merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, _mdc);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:9,代码来源:TimeDataTypeReportTests.cs

示例6: 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();
        }
开发者ID:sillsdev,项目名称:chack,代码行数:12,代码来源:ChorusNotesAnnotationMergingStrategy.cs

示例7: CreateXmlMergerForFieldWorksData

 internal static XmlMerger CreateXmlMergerForFieldWorksData(MergeOrder mergeOrder, MetadataCache mdc)
 {
     var merger = new XmlMerger(mergeOrder.MergeSituation)
         {
             EventListener = mergeOrder.EventListener
         };
     BootstrapSystem(mdc, merger);
     return merger;
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:9,代码来源:FieldWorksMergeServices.cs

示例8: 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);
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:9,代码来源:CustomLayoutMergeService.cs

示例9: 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);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:9,代码来源:FieldWorksConfigurationLayoutTypeHandlerStrategy.cs

示例10: MergeSituation

        //this one is only for deserializing
        private MergeSituation(string relativePathToFile, MergeOrder.ConflictHandlingModeChoices conflictHandlingMode)
        {
            ConflictHandlingMode = conflictHandlingMode;

            if (relativePathToFile != null)
                relativePathToFile = relativePathToFile.Trim(new[] { Path.DirectorySeparatorChar });

            PathToFileInRepository = relativePathToFile;
        }
开发者ID:sillsdev,项目名称:chack,代码行数:10,代码来源:MergeSituation.cs

示例11: 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);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:10,代码来源:CustomLayoutMergeService.cs

示例12: LiftRangesMergingStrategy

        /// <summary>
        /// Constructor
        /// </summary>
        public LiftRangesMergingStrategy(MergeOrder mergeOrder)
        {
            _merger = new XmlMerger(mergeOrder.MergeSituation)
                {
                    EventListener = mergeOrder.EventListener
                };

            LiftBasicElementStrategiesMethod.AddLiftBasicElementStrategies(_merger.MergeStrategies);
            LiftRangesElementStrategiesMethod.AddLiftRangeElementStrategies(_merger.MergeStrategies);
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:13,代码来源:LiftRangesMergingStrategy.cs

示例13: 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);
        }
开发者ID:sillsdev,项目名称:chack,代码行数:13,代码来源:LiftEntryMergingStrategy.cs

示例14: 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);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:10,代码来源:ReferenceAtomicDataTypeReportTests.cs

示例15: Do3WayMerge

		/// <summary>
		/// All callers merging FieldWorks data need to pass 'true', so the MDC will know about  any custom properties for their classes.
		///
		/// Non-object callers (currently only the merge of the custom property definitions themselves) shoudl pass 'false'.
		/// </summary>
		internal static void Do3WayMerge(MergeOrder mergeOrder, MetadataCache mdc, bool addcustomPropertyInformation)
		{
			// Skip doing this for the Custom property definiton file, since it has no real need for the custom prop definitions,
			// which are being merged (when 'false' is provided).
			if (addcustomPropertyInformation)
				mdc.AddCustomPropInfo(mergeOrder); // NB: Must be done before FieldWorksCommonMergeStrategy is created. since it used the MDC.

			var merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, mdc);
			merger.EventListener = mergeOrder.EventListener;
			var mergeResults = merger.MergeFiles(mergeOrder.pathToOurs, mergeOrder.pathToTheirs, mergeOrder.pathToCommonAncestor);
			// Write out merged data.
			FileWriterService.WriteNestedFile(mergeOrder.pathToOurs, mergeResults.MergedNode);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:18,代码来源:FieldWorksCommonFileHandler.cs


注:本文中的Chorus.merge.MergeOrder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。