• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TextLine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DrawTextLine

        private static void DrawTextLine(Graphics grph, TextLine line)
        {
            foreach (Word word in line.Words)
                DrawWord(grph, word);

            line.Draw(grph);
        }
开发者ID:mjmoura,项目名称:tesseractdotnet,代码行数:7,代码来源:Program.cs


示例2: PutText

 void PutText(int typeId, string text)
 {
     TextLine tl = new TextLine(typeId, text);
     lines.Insert(0, tl);
     if (maxLines > 0 && lines.Count > maxLines)
         lines.RemoveRange(maxLines, lines.Count - maxLines);
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:7,代码来源:TextBuffer.cs


示例3: AbstractIndenter

            public AbstractIndenter(
                ISyntaxFactsService syntaxFacts,
                SyntaxTree syntaxTree,
                IEnumerable<IFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                var syntaxRoot = syntaxTree.GetRoot(cancellationToken);

                this._syntaxFacts = syntaxFacts;
                this.OptionSet = optionSet;
                this.Tree = syntaxTree;
                this.LineToBeIndented = lineToBeIndented;
                this.TabSize = this.OptionSet.GetOption(FormattingOptions.TabSize, syntaxRoot.Language);
                this.CancellationToken = cancellationToken;

                this.Rules = rules;
                this.Finder = new BottomUpBaseIndentationFinder(
                         new ChainedFormattingRules(this.Rules, OptionSet),
                         this.TabSize,
                         this.OptionSet.GetOption(FormattingOptions.IndentationSize, syntaxRoot.Language),
                         tokenStream: null,
                         lastToken: default(SyntaxToken));
            }
开发者ID:Rickinio,项目名称:roslyn,代码行数:25,代码来源:AbstractIndentationService.AbstractIndenter.cs


示例4: GetIndentationOfLine

            protected IndentationResult GetIndentationOfLine(TextLine lineToMatch, int addedSpaces)
            {
                var firstNonWhitespace = lineToMatch.GetFirstNonWhitespacePosition();
                firstNonWhitespace = firstNonWhitespace ?? lineToMatch.End;

                return GetIndentationOfPosition(firstNonWhitespace.Value, addedSpaces);
            }
开发者ID:RoryVL,项目名称:roslyn,代码行数:7,代码来源:AbstractIndentationService.AbstractIndenter.cs


示例5: CSVSheet

    CSVSheet(string filePath, TextLine textLine)
    {
        Assert.IsTrue(textLine != null);

        this.filePath = filePath;

        using (var lines = textLine.GetEnumerator())
        {
            lines.MoveNext();
            string colNames = lines.Current;
            lines.MoveNext();
            string colTypes = lines.Current;
            this.columnInfo = new ColumnInfo(colNames, colTypes, filePath);

            List<RowData> tempList = new List<RowData>();
            while (lines.MoveNext())
            {
                string line = lines.Current;
                if (!string.IsNullOrEmpty(line))
                {
                    var tokens = line.Split(',');
                    var newRow = new RowData(tokens);
                    Assert.IsTrue(newRow.IsValidInLength(columnInfo), string.Format("tokens.Length={0}, columnInfo.Length={1} in \n{2}", tokens.Length, columnInfo.Length, line));
                    int errIndex;
                    Assert.IsTrue(newRow.IsValidInType(columnInfo, out errIndex), errIndex < 0 ? string.Empty : string.Format("Converting error: [{0}] to {1} in {2}", tokens[errIndex], columnInfo[errIndex].Value, filePath));
                    tempList.Add(newRow);
                }
            }
            rows = tempList;
        }
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:31,代码来源:CSVSheet.cs


示例6: GetIndenter

 protected override AbstractIndenter GetIndenter(
     ISyntaxFactsService syntaxFacts, SyntaxTree syntaxTree, TextLine lineToBeIndented, IEnumerable<IFormattingRule> formattingRules, OptionSet optionSet, CancellationToken cancellationToken)
 {
     return new Indenter(
         syntaxFacts, syntaxTree, formattingRules,
         optionSet, lineToBeIndented, cancellationToken);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:CSharpIndentationService.cs


示例7: TextLineInfo

 public TextLineInfo(string file, IImage img, TextLine line, bool orient)
 {
     Line = line;
     var firstRect = line.Chars.First();
     Coordinate = new Point(firstRect.Left, firstRect.Top);
     FileName = file;
     Size = img.Size;
     Orientation = orient;
 }
开发者ID:xoposhiy,项目名称:Orient,代码行数:9,代码来源:TextLineInfo.cs


示例8: Example_04

    public Example_04()
    {
        String fileName = "data/happy-new-year.txt";

        FileStream fos = new FileStream("Example_04.pdf", FileMode.Create);
        BufferedStream bos = new BufferedStream(fos);

        PDF pdf = new PDF(bos);
        pdf.setCompressor(Compressor.ORIGINAL_ZLIB);

        Font f1 = new Font(
                pdf,
                "AdobeMingStd-Light",       // Chinese (Traditional) font
                CodePage.UNICODE);
        Font f2 = new Font(
                pdf,
                "AdobeSongStd-Light",       // Chinese (Simplified) font
                CodePage.UNICODE);
        Font f3 = new Font(
                pdf,
                "KozMinProVI-Regular",      // Japanese font
                CodePage.UNICODE);
        Font f4 = new Font(
                pdf,
                "AdobeMyungjoStd-Medium",   // Korean font
                CodePage.UNICODE);

        Page page = new Page(pdf, Letter.PORTRAIT);

        f1.SetSize(14);
        f2.SetSize(14);
        f3.SetSize(14);
        f4.SetSize(14);

        double x_pos = 100.0;
        double y_pos = 20.0;
        StreamReader reader = new StreamReader(
                new FileStream(fileName, FileMode.Open));
        TextLine text = new TextLine(f1);
        String line = null;
        while ((line = reader.ReadLine()) != null) {
            if (line.IndexOf("Simplified") != -1) {
                text.SetFont(f2);
            } else if (line.IndexOf("Japanese") != -1) {
                text.SetFont(f3);
            } else if (line.IndexOf("Korean") != -1) {
                text.SetFont(f4);
            }
            text.SetText(line);
            text.SetPosition(x_pos, y_pos += 24);
            text.DrawOn(page);
        }
        reader.Close();

        pdf.Flush();
        bos.Close();
    }
开发者ID:pauljs,项目名称:Justin-Paul-s-Projects,代码行数:57,代码来源:Example_04.cs


示例9: CheckEqualLine

        void CheckEqualLine(TextLine first, TextLine second)
        {
            Assert.Equal(first, second);
#if false
            // We do not guarantee either identity or Equals!
            Assert.Equal(first.Extent, second.Extent);
            Assert.Equal(first.ExtentIncludingLineBreak, second.ExtentIncludingLineBreak);
#endif
        }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:StringTextTest.cs


示例10: ShouldUseSmartTokenFormatterInsteadOfIndenter

 protected override bool ShouldUseSmartTokenFormatterInsteadOfIndenter(
     IEnumerable<IFormattingRule> formattingRules,
     SyntaxNode root,
     TextLine line,
     OptionSet optionSet,
     CancellationToken cancellationToken)
 {
     return ShouldUseSmartTokenFormatterInsteadOfIndenter(
         formattingRules, (CompilationUnitSyntax)root, line, optionSet, cancellationToken);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:10,代码来源:CSharpIndentationService.cs


示例11: ShouldUseSmartTokenFormatterInsteadOfIndenter

        public static bool ShouldUseSmartTokenFormatterInsteadOfIndenter(
            IEnumerable<IFormattingRule> formattingRules,
            CompilationUnitSyntax root,
            TextLine line,
            OptionSet optionSet,
            CancellationToken cancellationToken)
        {
            Contract.ThrowIfNull(formattingRules);
            Contract.ThrowIfNull(root);

            if (!optionSet.GetOption(FeatureOnOffOptions.AutoFormattingOnReturn, LanguageNames.CSharp))
            {
                return false;
            }

            if (optionSet.GetOption(FormattingOptions.SmartIndent, LanguageNames.CSharp) != FormattingOptions.IndentStyle.Smart)
            {
                return false;
            }

            var firstNonWhitespacePosition = line.GetFirstNonWhitespacePosition();
            if (!firstNonWhitespacePosition.HasValue)
            {
                return false;
            }

            var token = root.FindToken(firstNonWhitespacePosition.Value);
            if (token.IsKind(SyntaxKind.None) ||
                token.SpanStart != firstNonWhitespacePosition)
            {
                return false;
            }

            // first see whether there is a line operation for current token
            var previousToken = token.GetPreviousToken(includeZeroWidth: true);

            // only use smart token formatter when we have two visible tokens.
            if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing)
            {
                return false;
            }

            var lineOperation = FormattingOperations.GetAdjustNewLinesOperation(formattingRules, previousToken, token, optionSet);
            if (lineOperation == null || lineOperation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine)
            {
                // no indentation operation, nothing to do for smart token formatter
                return false;
            }

            // We're pressing enter between two tokens, have the formatter figure out hte appropriate
            // indentation.
            return true;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:53,代码来源:CSharpIndentationService.cs


示例12: IsBlank

        private static bool IsBlank(TextLine line)
        {
            var text = line.ToString();

            for (int i = 0; i < text.Length; i++)
            {
                if (!SyntaxFacts.IsWhitespace(text[i]))
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:14,代码来源:BreakpointGetter.cs


示例13: SplitByLines

		public void SplitByLines(float _width, EFonts _font, float _newLineIndent, IDrawHelper _drawHelper)
		{
			var textLines = new List<TextLine>();

			var paragraphs = Text.Split(new[] {Environment.NewLine, "\t"}, StringSplitOptions.RemoveEmptyEntries);

			var sb = new StringBuilder();
			foreach (var paragraph in paragraphs)
			{
				sb.Clear();
				var x = _newLineIndent;

				var tl = new TextLine(x, Highlights);
				textLines.Add(tl);

				var part = paragraph.Split(Punctuation);
				var processedChars = 0;
				for (var partIndex = 0; partIndex < part.Length; partIndex++)
				{
					var addStr = part[partIndex];
					processedChars += addStr.Length;
					addStr += (processedChars == 0 || processedChars >= paragraph.Length)
					          	? ""
					          	: paragraph[processedChars].ToString(CultureInfo.InvariantCulture);
					processedChars++;
					var size = _drawHelper.MeasureString(_font, addStr);

					if (size.Width > (_width - x))
					{
						tl.Text = sb.ToString();
						sb.Clear();
						x = 0;
						tl = new TextLine(x, Highlights);
						textLines.Add(tl);
					}
					sb.Append(addStr);
					x += size.Width;
				}

				if (sb.Length > 0)
				{
					tl.Text = sb.ToString();
				}
			}
			m_textLines = textLines.ToArray();
		}
开发者ID:Foxbow74,项目名称:my-busycator,代码行数:46,代码来源:TextPortion.cs


示例14: TableGenerator

    TableGenerator(string resPath, string className)
    {
        TextAsset csvFile = Resources.Load(resPath) as TextAsset;
        Assert.IsTrue(csvFile != null, "File not found: " + resPath);

        TextLine textLine = new TextLine(csvFile.text);
        Assert.IsTrue(textLine != null);

        using (var lines = textLine.GetEnumerator())
        {
            lines.MoveNext();
            string colNames = lines.Current;
            lines.MoveNext();
            string colTypes = lines.Current;
            this.columnInfo = new ColumnInfo(colNames, colTypes, resPath);
        }
        this.className = className;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:18,代码来源:TableGenerator.cs


示例15: ItemGetter

 private ItemGetter(
     AbstractOverrideCompletionProvider overrideCompletionProvider,
     Document document, 
     int position, 
     SourceText text,
     SyntaxTree syntaxTree,
     int startLineNumber,
     TextLine startLine,
     CancellationToken cancellationToken)
 {
     _provider = overrideCompletionProvider;
     _document = document;
     _position = position;
     _text = text;
     _syntaxTree = syntaxTree;
     _startLineNumber = startLineNumber;
     _startLine = startLine;
     _cancellationToken = cancellationToken;
 }
开发者ID:TyOverby,项目名称:roslyn,代码行数:19,代码来源:AbstractOverrideCompletionProvider.ItemGetter.cs


示例16: TestBackgroundBrush1

        public void TestBackgroundBrush1()
        {
            var textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Fatal), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.ErrorBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Error), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.ErrorBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Warning), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.WarningBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Info), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.NormalBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Debug), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.NormalBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.None), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.NormalBackgroundBrush);
        }
开发者ID:Kittyfisto,项目名称:Tailviewer,代码行数:20,代码来源:TextLineTest.cs


示例17: TestBackgroundBrush3

        public void TestBackgroundBrush3()
        {
            _selected.Add(new LogLineIndex(0));

            var textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Fatal), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Error), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Warning), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Info), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Debug), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);

            textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.None), _hovered, _selected, true);
            textLine.BackgroundBrush.Should().Be(TextHelper.SelectedBackgroundBrush);
        }
开发者ID:Kittyfisto,项目名称:Tailviewer,代码行数:22,代码来源:TextLineTest.cs


示例18: AbstractIndenter

            public AbstractIndenter(
                SyntacticDocument document,
                IEnumerable<IFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                this.OptionSet = optionSet;
                this.Document = document;
                this.LineToBeIndented = lineToBeIndented;
                this.TabSize = this.OptionSet.GetOption(FormattingOptions.TabSize, this.Document.Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules = rules;
                this.Tree = this.Document.SyntaxTree;
                this.Finder = new BottomUpBaseIndentationFinder(
                         new ChainedFormattingRules(this.Rules, OptionSet),
                         this.TabSize,
                         this.OptionSet.GetOption(FormattingOptions.IndentationSize, this.Document.Root.Language),
                         tokenStream: null,
                         lastToken: default(SyntaxToken));
            }
开发者ID:RoryVL,项目名称:roslyn,代码行数:22,代码来源:AbstractIndentationService.AbstractIndenter.cs


示例19: FindLine

        private TextLine FindLine(int absoluteIndex)
        {
            TextLine selected = null;

            if (_currentLine != null)
            {
                if (_currentLine.Contains(absoluteIndex))
                {
                    // This index is on the last read line
                    selected = _currentLine;
                }
                else if (absoluteIndex > _currentLine.Index && _currentLine.Index + 1 < _lines.Count)
                {
                    // This index is ahead of the last read line
                    selected = ScanLines(absoluteIndex, _currentLine.Index);
                }
            }

            // Have we found a line yet?
            if (selected == null)
            {
                // Scan from line 0
                selected = ScanLines(absoluteIndex, 0);
            }

            Debug.Assert(selected == null || selected.Contains(absoluteIndex));
            _currentLine = selected;
            return selected;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:29,代码来源:LineTrackingStringBuffer.cs


示例20: PushNewLine

 private void PushNewLine()
 {
     _endLine = new TextLine(_endLine.End, _endLine.Index + 1);
     _lines.Add(_endLine);
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:5,代码来源:LineTrackingStringBuffer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextLocation类代码示例发布时间:2022-05-24
下一篇:
C# TextGenerator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap