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

C# TextSource类代码示例

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

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



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

示例1: EmptyXmlDocumentTokenization

 public void EmptyXmlDocumentTokenization()
 {
     var s = new TextSource("");
     var t = CreateTokenizer(s);
     var e = t.Get();
     Assert.IsInstanceOf<XmlEndOfFileToken>(e);
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:7,代码来源:XmlTokenization.cs


示例2: PaintParaBox

		public void PaintParaBox()
		{
			AssembledStyles styles = new AssembledStyles();
			var clientRuns = new List<IClientRun>();
			BlockBox box0 = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box0);
			BlockBox box1 = new BlockBox(styles, Color.Blue, 36000, 18000);
			clientRuns.Add(box1);
			BlockBox box2 = new BlockBox(styles, Color.Red, 24000, 18000);
			clientRuns.Add(box2);
			BlockBox box3 = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box3);
			BlockBox box4 = new BlockBox(styles, Color.Red, 36000, 36000);
			clientRuns.Add(box4);

			TextSource source = new TextSource(clientRuns, null);
			ParaBox para = new ParaBox(styles, source);
			RootBox root = new RootBox(styles);
			root.AddBox(para);

			MockGraphics graphics = new MockGraphics();
			LayoutInfo layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);
			root.Layout(layoutArgs);

			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			root.Paint(graphics, ptrans);
			Assert.AreEqual(5, graphics.RectanglesDrawn.Count);
			VerifyRect(2, 2, 96, 48, graphics, 0, Color.Red);
			VerifyRect(2, 48+2, 48, 24, graphics, 1, Color.Blue);
			VerifyRect(2+48, 48 + 2, 32, 24, graphics, 2, Color.Red);
			VerifyRect(2, 24 + 48 + 2, 96, 48, graphics, 3, Color.Red);
			VerifyRect(2, 48 + 24 + 48 + 2, 48, 48, graphics, 4, Color.Red);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:ParaTests.cs


示例3: TokenizationTagSelfClosingDetected

 public void TokenizationTagSelfClosingDetected()
 {
     var s = new TextSource("<img />");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(true, ((HtmlTagToken)token).IsSelfClosing);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:7,代码来源:HtmlTokenization.cs


示例4: Clone

 public override INode Clone(Boolean deep = true)
 {
     var source = new TextSource(Source.Text);
     var node = new HtmlDocument(Context, source);
     CloneDocument(node, deep);
     return node;
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:7,代码来源:HtmlDocument.cs


示例5: TokenizationTagNameDetection

 public void TokenizationTagNameDetection()
 {
     var s = new TextSource("<span>");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual("span", ((HtmlTagToken)token).Name);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:7,代码来源:HtmlTokenization.cs


示例6: TokenizationFinalEOF

 public void TokenizationFinalEOF()
 {
     var s = new TextSource("");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.EndOfFile, token.Type);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:7,代码来源:HtmlTokenization.cs


示例7: ClearSelected

        internal static void ClearSelected(TextSource ts)
        {
            var tb = ts.CurrentTB;

            Place start = tb.Selection.Start;
            Place end = tb.Selection.End;
            int fromLine = Math.Min(end.iLine, start.iLine);
            int toLine = Math.Max(end.iLine, start.iLine);
            int fromChar = tb.Selection.FromX;
            int toChar = tb.Selection.ToX;
            if (fromLine < 0) return;
            //
            if (fromLine == toLine)
                ts[fromLine].RemoveRange(fromChar, toChar - fromChar);
            else
            {
                ts[fromLine].RemoveRange(fromChar, ts[fromLine].Count - fromChar);
                ts[toLine].RemoveRange(0, toChar);
                ts.RemoveLine(fromLine + 1, toLine - fromLine - 1);
                InsertCharCommand.MergeLines(fromLine, ts);
            }
            //
            tb.Selection.Start = new Place(fromChar, fromLine);
            //
            ts.NeedRecalc(new TextSource.TextChangedEventArgs(fromLine, toLine));
        }
开发者ID:brunoviske,项目名称:CogEngine,代码行数:26,代码来源:Commands.cs


示例8: HtmlTokenizer

 /// <summary>
 /// See 8.2.4 Tokenization
 /// </summary>
 /// <param name="source">The source code manager.</param>
 /// <param name="events">The event aggregator to use.</param>
 public HtmlTokenizer(TextSource source, IEventAggregator events)
     : base(source, events)
 {
     _state = HtmlParseMode.PCData;
     _acceptsCharacterData = false;
     _lastStartTag = String.Empty;
 }
开发者ID:JBTech,项目名称:AngleSharp,代码行数:12,代码来源:HtmlTokenizer.cs


示例9: TokenizationBogusCommentQuestionMark

 public void TokenizationBogusCommentQuestionMark()
 {
     var s = new TextSource("<?>");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.Comment, token.Type);
     Assert.AreEqual("?", token.Data);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:8,代码来源:HtmlTokenization.cs


示例10: TokenizationBogusCommentClosingTag

 public void TokenizationBogusCommentClosingTag()
 {
     var s = new TextSource("</ >");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.Comment, token.Type);
     Assert.AreEqual(" ", token.Data);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:8,代码来源:HtmlTokenization.cs


示例11: TokenizationBogusCommentEmpty

 public void TokenizationBogusCommentEmpty()
 {
     var s = new TextSource("<!>");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.Comment, token.Type);
     Assert.AreEqual(String.Empty, token.Data);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:8,代码来源:HtmlTokenization.cs


示例12: TokenizationStartTagDetection

 public void TokenizationStartTagDetection()
 {
     var s = new TextSource("<p>");
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.StartTag, token.Type);
     Assert.AreEqual("p", ((HtmlTagToken)token).Name);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:8,代码来源:HtmlTokenization.cs


示例13: SetDefault

 /// <summary>
 /// Sets a new default stylesheet defined by the provided string.
 /// </summary>
 /// <param name="sourceCode">The source for a new base stylesheet.</param>
 /// <returns>The CSSOM of the parsed source.</returns>
 public ICssStyleSheet SetDefault(String sourceCode)
 {
     var parser = new CssParser(_options);
     var source = new TextSource(sourceCode);
     var sheet = new CssStyleSheet(parser, default(String), default(ICssStyleSheet));
     _default = Parse(parser, sheet, source).Result;
     return _default;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:13,代码来源:CssStyleEngine.cs


示例14: ValidXmlDeclarationOnlyVersion

 public void ValidXmlDeclarationOnlyVersion()
 {
     var s = new TextSource("<?xml version=\"1.0\"?>");
     var t = CreateTokenizer(s);
     var e = t.Get();
     Assert.AreEqual(XmlTokenType.Declaration, e.Type);
     Assert.AreEqual("1.0", ((XmlDeclarationToken)e).Version);
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:8,代码来源:XmlTokenization.cs


示例15: Reader

        public Reader(TextSource textSource, TextRenderer textRenderer, double maxWPM)
        {
            this.maxWPM = maxWPM;
            this.textRenderer = textRenderer;
            this.textSource = textSource;

            this.wordTimer = new Timer(START_WORD_INTERVAL);
            wordTimer.Elapsed += new ElapsedEventHandler(wordTimerHandler);
        }
开发者ID:jjonj,项目名称:qkReader,代码行数:9,代码来源:Reader.cs


示例16: TokenizationLongerCharacterReference

 public void TokenizationLongerCharacterReference()
 {
     var content = "&abcdefghijklmnopqrstvwxyzABCDEFGHIJKLMNOPQRSTV;";
     var s = new TextSource(content);
     var t = new HtmlTokenizer(s, null);
     var token = t.Get();
     Assert.AreEqual(HtmlTokenType.Character, token.Type);
     Assert.AreEqual(content, token.Data);
 }
开发者ID:kk9599,项目名称:AngleSharp,代码行数:9,代码来源:HtmlTokenization.cs


示例17: HtmlTokenizer

 /// <summary>
 /// See 8.2.4 Tokenization
 /// </summary>
 /// <param name="source">The source code manager.</param>
 /// <param name="resolver">The entity resolver to use.</param>
 public HtmlTokenizer(TextSource source, IEntityProvider resolver)
     : base(source)
 {
     State = HtmlParseMode.PCData;
     IsAcceptingCharacterData = false;
     IsStrictMode = false;
     _lastStartTag = String.Empty;
     _resolver = resolver;
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:14,代码来源:HtmlTokenizer.cs


示例18: StringsInSource

		public void StringsInSource()
		{
			ITsString tss = tsf.MakeString("abc def", wsEn);
			AssembledStyles styles = new AssembledStyles();
			TssClientRun clientRun = new TssClientRun(tss, styles);
			var clientRuns = new List<IClientRun>();
			clientRuns.Add(clientRun);
			TextSource ts = new TextSource(clientRuns);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:TextSourceTests.cs


示例19: OneCommentInXmlDocument

 public void OneCommentInXmlDocument()
 {
     var c = "My comment";
     var s = new TextSource("<!--" + c + "-->");
     var t = CreateTokenizer(s);
     var e = t.Get();
     Assert.AreEqual(XmlTokenType.Comment, e.Type);
     Assert.AreEqual(c, ((XmlCommentToken)e).Data);
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:9,代码来源:XmlTokenization.cs


示例20: RemoveLinesCommand

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ts">Underlaying TextSource</param>
 /// <param name="iLines">List of line indices to be removed</param>
 public RemoveLinesCommand(TextSource ts, List<int> iLines)
     : base(ts)
 {
     //sort iLines
     iLines.Sort();
     //
     this.iLines = iLines;
     lastSel = sel = new RangeInfo(ts.CurrentTB.Selection);
 }
开发者ID:rickaas,项目名称:FastColoredTextBox,代码行数:14,代码来源:RemoveLinesCommand.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TextSpan类代码示例发布时间:2022-05-24
下一篇:
C# TextSegment类代码示例发布时间: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