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


C# TreeList.AddBranch方法代码示例

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


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

示例1: MakeTables

        void MakeTables(TreeList<CellBase> result)
        {
            string leader = string.Empty;
            TreeList<CellBase> table = null;
            scanner.MoveNext();
            do {
                if (scanner.Current.Type == TokenType.Leader) {
                    leader = scanner.Current.Content;
                    scanner.MoveNext();
                }
                else if (scanner.Current.Type == TokenType.Word) {
                    table = new TreeList<CellBase>(new CellBase(string.Empty));
                    table.Value.SetAttribute(CellAttribute.StartTag, "<p>");
                    table.Value.SetAttribute(CellAttribute.EndTag, "</p>");
                    if (leader.Length > 0) {
                        table.Value.SetAttribute(CellAttribute.Leader, leader);
                        leader = string.Empty;
                    }
                    result.AddBranch(table);
                    MakeRows(table);
                    if (scanner.Current.Type == TokenType.Newline) scanner.MoveNext();
                }
                else {
                    scanner.MoveNext();
                }
            } while (scanner.Current.Type != TokenType.End);

            if (table != null && scanner.Current.Content.Length > 0) {
                 table.Value.SetAttribute(CellAttribute.Trailer, scanner.Current.Content);
            }
        }
开发者ID:abombss,项目名称:fitsharp,代码行数:31,代码来源:TextTables.cs

示例2: MakeRows

 void MakeRows(TreeList<CellBase> table) {
     do {
         var row = new TreeList<CellBase>(new CellBase(string.Empty));
         row.Value.SetAttribute(CellAttribute.StartTag, startTags[1]);
         row.Value.SetAttribute(CellAttribute.EndTag, endTags[1]);
         table.AddBranch(row);
         MakeCells(row);
         if (scanner.Current.Type == TokenType.Newline) scanner.MoveNext();
     } while (scanner.Current.Type == TokenType.BeginCell || scanner.Current.Type == TokenType.Word);
 }
开发者ID:GibSral,项目名称:fitsharp,代码行数:10,代码来源:TextTables.cs

示例3: MakeCells

 void MakeCells(TreeList<CellBase> row)
 {
     while (scanner.Current.Type == TokenType.Word) {
         var cell = new TreeList<CellBase>(new CellBase(scanner.Current.Content));
         cell.Value.SetAttribute(CellAttribute.Body, scanner.Current.Content);
         cell.Value.SetAttribute(CellAttribute.StartTag, "<span>");
         cell.Value.SetAttribute(CellAttribute.EndTag, "</span> ");
         row.AddBranch(cell);
         scanner.MoveNext();
     }
 }
开发者ID:abombss,项目名称:fitsharp,代码行数:11,代码来源:TextTables.cs

示例4: Parse

 public Tree<CellBase> Parse(string input) {
     var alternationParser = new AlternationParser();
     var cells = new ListParser("td", alternationParser, false);
     var rows = new ListParser("tr", cells, true);
     var tables = new ListParser("table", rows, true);
     var items = new ListParser("li", alternationParser, false);
     var lists = new ListParser("ul", items, true);
     alternationParser.ChildParsers = new [] {tables, lists};
     var root = new CellBase(string.Empty, "div");
     var result = new TreeList<CellBase>(root);
     foreach (Tree<CellBase> branch in tables.Parse(new LexicalAnalyzer(input))) result.AddBranch(branch);
     return result;
 }
开发者ID:GibSral,项目名称:fitsharp,代码行数:13,代码来源:HtmlTables.cs

示例5: MakeCells

 void MakeCells(TreeList<CellBase> row)
 {
     while (scanner.Current.Type == TokenType.BeginCell || scanner.Current.Type == TokenType.Word) {
         var cell = new TreeList<CellBase>(new CellBase(scanner.Current.Content));
         cell.Value.SetAttribute(CellAttribute.StartTag, startTags[2]);
         cell.Value.SetAttribute(CellAttribute.EndTag, endTags[2]);
         if (scanner.Current.Type == TokenType.BeginCell) {
             MakeTables(cell);
         }
         else if (scanner.Current.Type == TokenType.Word) {
             cell.Value.SetAttribute(CellAttribute.Body, HttpUtility.HtmlEncode(scanner.Current.Content));
         }
         row.AddBranch(cell);
         scanner.MoveNext();
     }
 }
开发者ID:nhajratw,项目名称:fitsharp,代码行数:16,代码来源:TextTables.cs

示例6: ParseElement

 Tree<CellBase> ParseElement(LexicalAnalyzer theAnalyzer) {
     string tag = theAnalyzer.Token;
     string leader = theAnalyzer.Leader;
     theAnalyzer.PushEnd("/" + myKeyword);
     List<Tree<CellBase>> children = myChildParser.Parse(theAnalyzer);
     if (IRequireChildren && children.Count == 0) {
         throw new ApplicationException(string.Format("Can't find tag: {0}", myChildParser.Keyword));
     }
     theAnalyzer.PopEnd();
     theAnalyzer.GoToNextToken("/" + myKeyword);
     if (theAnalyzer.Token.Length == 0) throw new ApplicationException("expected /" + myKeyword + " tag");
     var result = new TreeList<CellBase>(new CellBase(HtmlToText(theAnalyzer.Leader)));
     result.Value.SetAttribute(CellAttribute.Body, theAnalyzer.Leader);
     result.Value.SetAttribute(CellAttribute.EndTag, theAnalyzer.Token);
     if (leader.Length > 0) result.Value.SetAttribute(CellAttribute.Leader, leader);
     result.Value.SetAttribute(CellAttribute.StartTag, tag);
     foreach (Tree<CellBase> child in children) result.AddBranch(child);
     return result;
 }
开发者ID:GibSral,项目名称:fitsharp,代码行数:19,代码来源:HtmlTables.cs


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