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


C# TextSource类代码示例

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


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


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