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


C# TextDocument.CreateSnapshot方法代码示例

本文整理汇总了C#中ICSharpCode.AvalonEdit.Document.TextDocument.CreateSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C# TextDocument.CreateSnapshot方法的具体用法?C# TextDocument.CreateSnapshot怎么用?C# TextDocument.CreateSnapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.AvalonEdit.Document.TextDocument的用法示例。


在下文中一共展示了TextDocument.CreateSnapshot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NoChanges

		public void NoChanges()
		{
			TextDocument document = new TextDocument("initial text");
			ITextSource snapshot1 = document.CreateSnapshot();
			ITextSource snapshot2 = document.CreateSnapshot();
			Assert.AreEqual(0, snapshot1.Version.CompareAge(snapshot2.Version));
			Assert.AreEqual(0, snapshot1.Version.GetChangesTo(snapshot2.Version).Count());
			Assert.AreEqual(document.Text, snapshot1.Text);
			Assert.AreEqual(document.Text, snapshot2.Text);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:10,代码来源:ChangeTrackingTest.cs

示例2: NoChanges

		public void NoChanges()
		{
			TextDocument document = new TextDocument("initial text");
			ChangeTrackingCheckpoint checkpoint1, checkpoint2;
			ITextSource snapshot1 = document.CreateSnapshot(out checkpoint1);
			ITextSource snapshot2 = document.CreateSnapshot(out checkpoint2);
			Assert.AreEqual(0, checkpoint1.CompareAge(checkpoint2));
			Assert.AreEqual(0, checkpoint1.GetChangesTo(checkpoint2).Count());
			Assert.AreEqual(document.Text, snapshot1.Text);
			Assert.AreEqual(document.Text, snapshot2.Text);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:11,代码来源:ChangeTrackingTest.cs

示例3: BackwardChanges

		public void BackwardChanges()
		{
			TextDocument document = new TextDocument("initial text");
			ITextSource snapshot1 = document.CreateSnapshot();
			document.Replace(0, 7, "nw");
			document.Insert(1, "e");
			ITextSource snapshot2 = document.CreateSnapshot();
			Assert.AreEqual(1, snapshot2.Version.CompareAge(snapshot1.Version));
			TextChangeEventArgs[] arr = snapshot2.Version.GetChangesTo(snapshot1.Version).ToArray();
			Assert.AreEqual(2, arr.Length);
			Assert.AreEqual("", arr[0].InsertedText.Text);
			Assert.AreEqual("initial", arr[1].InsertedText.Text);
			
			Assert.AreEqual("initial text", snapshot1.Text);
			Assert.AreEqual("new text", snapshot2.Text);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:16,代码来源:ChangeTrackingTest.cs

示例4: BackwardChanges

		public void BackwardChanges()
		{
			TextDocument document = new TextDocument("initial text");
			ChangeTrackingCheckpoint checkpoint1, checkpoint2;
			ITextSource snapshot1 = document.CreateSnapshot(out checkpoint1);
			document.Replace(0, 7, "nw");
			document.Insert(1, "e");
			ITextSource snapshot2 = document.CreateSnapshot(out checkpoint2);
			Assert.AreEqual(1, checkpoint2.CompareAge(checkpoint1));
			DocumentChangeEventArgs[] arr = checkpoint2.GetChangesTo(checkpoint1).ToArray();
			Assert.AreEqual(2, arr.Length);
			Assert.AreEqual("", arr[0].InsertedText);
			Assert.AreEqual("initial", arr[1].InsertedText);
			
			Assert.AreEqual("initial text", snapshot1.Text);
			Assert.AreEqual("new text", snapshot2.Text);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:17,代码来源:ChangeTrackingTest.cs


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