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


C# TextBuffer.GetText方法代码示例

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


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

示例1: TextFormattingSource

		public TextFormattingSource(
			TextBuffer textBuffer
			, IClassificationFormatMap classificationFormatMap
			, Int32 startIndex
			, Int32 length
			, IList<ClassificationSpan> classificationSpans
			, IList<SpaceNegotiation> spaceNegotiations
			)
		{
			List<SpaceNegotiation> list = null;
			if (spaceNegotiations != null)
			{
				list = new List<SpaceNegotiation>(spaceNegotiations);
				list.Sort(new Comparison<SpaceNegotiation>(this.Comparison));
			}
			String text = textBuffer.GetText(startIndex, length);
			_normalizedSpanManager = new NormalizedSpanManager(text, startIndex, classificationSpans, list, classificationFormatMap);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:18,代码来源:TextFormattingSource.cs

示例2: Merge

		/*
		 * Merge
		 */

		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="normalizedChanges"/> is <see langword="null"/>.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="buffer"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		/// <exception cref="ArgumentOutOfRangeException">
		/// The amount of items in <paramref name="normalizedChanges"/> is less than 1.
		/// </exception>
		public static TextChange Merge(IList<TextChange> normalizedChanges, TextBuffer buffer)
		{
			if (normalizedChanges == null)
			{
				throw new ArgumentNullException("normalizedChanges");
			}

			if (normalizedChanges.Count < 1)
			{
				throw new ArgumentOutOfRangeException("normalizedChanges.Count");
			}

			if (buffer == null)
			{
				throw new ArgumentNullException("buffer");
			}

			Int32 position = normalizedChanges[0].Position;
			var builder = new StringBuilder();
			var builder2 = new StringBuilder();

			for (var i = 0; i < normalizedChanges.Count; i++)
			{
				TextChange change = normalizedChanges[i];
				builder.Append(change.OldText);
				builder2.Append(change.NewText);

				if ((i + 1) < normalizedChanges.Count)
				{
					Int32 length = normalizedChanges[i + 1].Position - normalizedChanges[i].NewEnd;
					String text = buffer.GetText(normalizedChanges[i].NewEnd, length);
					builder.Append(text);
					builder2.Append(text);
				}
			}

			return new TextChange(position, builder.ToString(), builder2.ToString());
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:56,代码来源:TextChange.cs


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