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


C# IDocument.GetLineFromLineNumber方法代码示例

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


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

示例1: IsNotSameScope

 bool IsNotSameScope(IDocument view, int lineNo, string original)
 {
     var line           = view.GetLineFromLineNumber(lineNo).Text.ReplaceTabs(view.TabSize);
     var lineIndent     = line    .Length - line    .TrimStart().Length;
     var originalIndent = original.Length - original.TrimStart().Length;
     return line.Trim() == string.Empty || lineIndent != originalIndent;
 }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:7,代码来源:XmlScopeSelector.cs

示例2: GetLinesToAlign

        public IEnumerable<ILine> GetLinesToAlign(IDocument view)
        {
            int start = view.StartSelectionLineNumber;
            int end   = view.EndSelectionLineNumber;

            if (start == end)
            {
                var line = view.GetLineFromLineNumber(start).Text.ReplaceTabs(view.TabSize);
                var isMulti = IsMultiLineTag(view, line);

                var blanks = isMulti ? start      .DownTo(0).Where(x => IsMultiLineStart(view, x))
                                     : (start + 1).DownTo(1).Where(x => IsNotSameScope(view, x - 1, line));

                start      = blanks.Any() ? blanks.First() : 0;

                blanks     = isMulti ?  end     .UpTo(view.LineCount - 1).Where(x => IsMultiLineEnd(view, x))
                                     : (end - 1).UpTo(view.LineCount - 2).Where(x => IsNotSameScope(view, x + 1, line));
                end        = blanks.Any() ? blanks.First() : view.LineCount - 1;
            }

            return start.UpTo(end).Select(x => view.GetLineFromLineNumber(x));
        }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:22,代码来源:XmlScopeSelector.cs

示例3: GetLinesToAlign

        public IEnumerable<ILine> GetLinesToAlign(IDocument view)
        {
            int start = view.StartSelectionLineNumber;
            int end   = view.EndSelectionLineNumber;

            if (start == end)
            {
                var blanks = start.DownTo(0).Where(x => IsLineBlank(view, x));
                start      = blanks.Any() ? blanks.First() + 1 : 0;

                blanks     = end.UpTo(view.LineCount - 1).Where(x => IsLineBlank(view, x));
                end        = blanks.Any() ? blanks.First() - 1 : view.LineCount -1;
            }

            return start.UpTo(end).Select(x => view.GetLineFromLineNumber(x));
        }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:16,代码来源:GeneralScopeSelector.cs

示例4: IsMultiLineStart

 bool IsMultiLineStart(IDocument view, int lineNo)
 {
     var blankStrings = new[] { string.Empty,  };
     var line = view.GetLineFromLineNumber(lineNo).Text.Trim();
     return line == string.Empty || line.StartsWith("<");
 }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:6,代码来源:XmlScopeSelector.cs

示例5: IsMultiLineEnd

 bool IsMultiLineEnd(IDocument view, int lineNo)
 {
     var blankStrings = new[] { string.Empty,  };
     var line = view.GetLineFromLineNumber(lineNo).Text.Trim();
     return line == string.Empty || line.Contains(">");
 }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:6,代码来源:XmlScopeSelector.cs

示例6: IsLineBlank

 bool IsLineBlank(IDocument view, int lineNo)
 {
     return Regex.IsMatch(view.GetLineFromLineNumber(lineNo).Text, ScopeSelectorRegex);
 }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:4,代码来源:GeneralScopeSelector.cs


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