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


C# TextDocument.GetLineByNumber方法代码示例

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


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

示例1: ClassMemberBookmark

		public ClassMemberBookmark(IMember member, TextDocument document)
		{
			this.member = member;
			int lineNr = member.Region.BeginLine;
			if (document != null && lineNr > 0 && lineNr <= document.LineCount)
				this.line = document.GetLineByNumber(lineNr);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:ClassMemberBookmark.cs

示例2: IndentLines

		/// <summary>
		/// Reindents a set of lines.
		/// </summary>
		/// <param name="document"></param>
		/// <param name="beginLine"></param>
		/// <param name="endLine"></param>
		public void IndentLines(TextDocument document, int beginLine, int endLine)
		{
			for (var i = beginLine; i <= endLine; i++)
			{
				IndentLine(document, document.GetLineByNumber(i));
			}
		}
开发者ID:andrebelanger,项目名称:HTMLEditor,代码行数:13,代码来源:HtmlIndentationStrategy.cs

示例3: CreateView

		/// <summary>
		/// Creates a new <see cref="FixedHighlighter"/> for a copy of a portion
		/// of the input document (including the original highlighting).
		/// </summary>
		public static FixedHighlighter CreateView(IHighlighter highlighter, int offset, int endOffset)
		{
			var oldDocument = highlighter.Document;
			// ReadOnlyDocument would be better; but displaying the view in AvalonEdit
			// requires a TextDocument
			var newDocument = new TextDocument(oldDocument.CreateSnapshot(offset, endOffset - offset));
			
			var oldStartLine = oldDocument.GetLineByOffset(offset);
			var oldEndLine = oldDocument.GetLineByOffset(endOffset);
			int oldStartLineNumber = oldStartLine.LineNumber;
			HighlightedLine[] newLines = new HighlightedLine[oldEndLine.LineNumber - oldStartLineNumber + 1];
			highlighter.BeginHighlighting();
			try {
				for (int i = 0; i < newLines.Length; i++) {
					HighlightedLine oldHighlightedLine = highlighter.HighlightLine(oldStartLineNumber + i);
					IDocumentLine newLine = newDocument.GetLineByNumber(1 + i);
					HighlightedLine newHighlightedLine = new HighlightedLine(newDocument, newLine);
					MoveSections(oldHighlightedLine.Sections, -offset, newLine.Offset, newLine.EndOffset, newHighlightedLine.Sections);
					newHighlightedLine.ValidateInvariants();
					newLines[i] = newHighlightedLine;
				}
			} finally {
				highlighter.EndHighlighting();
			}
			return new FixedHighlighter(newDocument, newLines);
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:30,代码来源:FixedHighlighter.cs

示例4: IndentLines

 public void IndentLines(TextDocument document, int beginLine, int endLine)
 {
     _doBeginUpdateManually = true;
     document.BeginUpdate();
     while (beginLine <= endLine)
     {
         IndentLine(document, document.GetLineByNumber(beginLine));
         beginLine++;
     }
     document.EndUpdate();
     _doBeginUpdateManually = false;
 }
开发者ID:rumbu13,项目名称:D-IDE,代码行数:12,代码来源:DIndentationStrategy.cs

示例5: CreateNewFoldings

        public override IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
        {
            firstErrorOffset = -1;
            
           var folds =  new List<NewFolding>();

            
            linenr = 1;
            prev = false;
            startfold = 0; endfold = 0;
            n = 0;
            var l = document.GetLineByNumber(linenr);
           
            int sep = 0;
           
            do
            {
                int N = l.TotalLength;
                var line = document.GetText(n, N);
                var M = r.Match(line);
                if (M.Success)
                {
                    if (!prev)
                    {
                        prev = true;
                        startfold = n;
                        
                    }
                    endfold = n + l.Length;   

                }
                else
                {

                    if (prev)
                        folds.Add(lastfold=new NewFolding{ StartOffset=startfold, EndOffset= endfold, Name="FileSync Complete", DefaultClosed=true});
                    prev = false;
                    
                   
                }



                linenr++;
                n += N;
            }
            while ((l = l.NextLine) != null);


            return folds;
        }
开发者ID:pksorensen,项目名称:C1AzureManager,代码行数:51,代码来源:DeploymentLogViewerViewModel.cs

示例6: GetNewLineFromDocument

		/// <summary>
		/// Gets the newline sequence used in the document at the specified line.
		/// </summary>
		public static string GetNewLineFromDocument(TextDocument document, int lineNumber)
		{
			DocumentLine line = document.GetLineByNumber(lineNumber);
			if (line.DelimiterLength == 0) {
				// at the end of the document, there's no line delimiter, so use the delimiter
				// from the previous line
				line = line.PreviousLine;
				if (line == null)
					return Environment.NewLine;
			}
			return document.GetText(line.Offset + line.Length, line.DelimiterLength);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:15,代码来源:NewLineFinder.cs

示例7: LineMarker

 public LineMarker(TextMarkerService svc, TextDocument doc, int beginLine, int endLine)
 {
     TextMarkerService = svc;
     StartOffset = doc.GetOffset(beginLine, 0);
     Length = doc.GetLineByNumber(endLine).EndOffset - StartOffset;
 }
开发者ID:aBothe,项目名称:DDebugger,代码行数:6,代码来源:BreakpointMarker.cs

示例8: ClassBookmark

		public ClassBookmark(IClass @class, TextDocument document)
		{
			[email protected] = @class;
			int lineNr = @class.Region.BeginLine;
			if (document != null && lineNr > 0 && lineNr <= document.LineCount)
				this.line = document.GetLineByNumber(lineNr);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:ClassMemberBookmark.cs

示例9: CreateInlineBuilder

		public static HighlightedInlineBuilder CreateInlineBuilder(Location startPosition, Location endPosition, TextDocument document, IHighlighter highlighter)
		{
			if (startPosition.Line >= 1 && startPosition.Line <= document.LineCount) {
				var matchedLine = document.GetLineByNumber(startPosition.Line);
				HighlightedInlineBuilder inlineBuilder = new HighlightedInlineBuilder(document.GetText(matchedLine));
				if (highlighter != null) {
					HighlightedLine highlightedLine = highlighter.HighlightLine(startPosition.Line);
					int startOffset = highlightedLine.DocumentLine.Offset;
					// copy only the foreground color
					foreach (HighlightedSection section in highlightedLine.Sections) {
						if (section.Color.Foreground != null) {
							inlineBuilder.SetForeground(section.Offset - startOffset, section.Length, section.Color.Foreground.GetBrush(null));
						}
					}
				}
				
				// now highlight the match in bold
				if (startPosition.Column >= 1) {
					if (endPosition.Line == startPosition.Line && endPosition.Column > startPosition.Column) {
						// subtract one from the column to get the offset inside the line's text
						int startOffset = startPosition.Column - 1;
						int endOffset = Math.Min(inlineBuilder.Text.Length, endPosition.Column - 1);
						inlineBuilder.SetFontWeight(startOffset, endOffset - startOffset, FontWeights.Bold);
					}
				}
				return inlineBuilder;
			}
			return null;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:29,代码来源:SearchResultsPad.cs

示例10: IsEmptyLine

 /// <summary>
 /// Determines whether a line of a document is empty (no characters or whitespace).
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="lineNumber">The line number.</param>
 /// <returns>
 /// <see langword="true"/> if line is empty of filled with whitespace; otherwise, 
 /// <see langword="false"/>.
 /// </returns>
 internal static bool IsEmptyLine(TextDocument document, int lineNumber)
 {
     return IsEmptyLine(document, document.GetLineByNumber(lineNumber));
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:13,代码来源:TextUtilities.cs

示例11: GetLineTerminator

        /// <summary>
        /// Gets the line terminator for the document around the specified line number.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="lineNumber">The line number.</param>
        /// <returns>The line terminator.</returns>
        internal static string GetLineTerminator(TextDocument document, int lineNumber)
        {
            DocumentLine line = document.GetLineByNumber(lineNumber);
            if (line.DelimiterLength == 0)
            {
                // at the end of the document, there's no line delimiter, so use the delimiter
                // from the previous line
                if (lineNumber == 1)
                    return Environment.NewLine;

                line = document.GetLineByNumber(lineNumber - 1);
            }
            return document.GetText(line.Offset + line.Length, line.DelimiterLength);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:20,代码来源:TextUtilities.cs

示例12: CreateInlineBuilder

		public static HighlightedInlineBuilder CreateInlineBuilder(Location startPosition, Location endPosition, TextDocument document, ISyntaxHighlighter highlighter)
		{
			if (startPosition.Line >= 1 && startPosition.Line <= document.LineCount) {
				HighlightedInlineBuilder inlineBuilder;
				if (highlighter != null) {
					inlineBuilder = highlighter.BuildInlines(startPosition.Line);
				} else {
					inlineBuilder = new HighlightedInlineBuilder(document.GetText(document.GetLineByNumber(startPosition.Line)));
				}
				
				// now highlight the match in bold
				if (startPosition.Column >= 1) {
					if (endPosition.Line == startPosition.Line && endPosition.Column > startPosition.Column) {
						// subtract one from the column to get the offset inside the line's text
						int startOffset = startPosition.Column - 1;
						int endOffset = Math.Min(inlineBuilder.Text.Length, endPosition.Column - 1);
						inlineBuilder.SetFontWeight(startOffset, endOffset - startOffset, FontWeights.Bold);
					}
				}
				return inlineBuilder;
			}
			return null;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:23,代码来源:SearchResultsPad.cs


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