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

C# GeneralTree类代码示例

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

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



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

示例1: Format

        public void Format(XLWorkbook workbook, GeneralTree<IDirectoryTreeNode> features)
        {
            IXLWorksheet tocWorksheet = workbook.AddWorksheet("TOC", 0);

            int startRow = 1;
            BuildTableOfContents(workbook, tocWorksheet, ref startRow, 1, features);
        }
开发者ID:ppnrao,项目名称:pickles,代码行数:7,代码来源:ExcelTableOfContentsFormatter.cs


示例2: Format

        public XDocument Format(FeatureNode featureNode, GeneralTree<FeatureNode> features)
        {
            var xmlns = XNamespace.Get("http://www.w3.org/1999/xhtml");
            var featureNodeOutputPath = Path.Combine(this.configuration.OutputFolder.FullName, featureNode.RelativePathFromRoot);
            var featureNodeOutputUri = new Uri(featureNodeOutputPath);

            var container = new XElement(xmlns + "div", new XAttribute("id", "container"));
            container.Add(this.htmlHeaderFormatter.Format());
            container.Add(this.htmlTableOfContentsFormatter.Format(featureNode.Url, features));
            container.Add(this.htmlContentFormatter.Format(featureNode));
            container.Add(this.htmlFooterFormatter.Format());

            var body = new XElement(xmlns + "body");
            body.Add(container);

            var head = new XElement(xmlns + "head");
            head.Add(new XElement(xmlns + "title", string.Format("{0}", featureNode.Name)));

            head.Add(new XElement(xmlns + "link",
                         new XAttribute("rel", "stylesheet"),
                         new XAttribute("href", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.MasterStylesheet)),
                         new XAttribute("type", "text/css")));

            var html = new XElement(xmlns + "html",
                           new XAttribute(XNamespace.Xml + "lang", "en"),
                           head,
                           body);

            var document = new XDocument(
                                new XDeclaration("1.0", "UTF-8", null),
                                new XDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", string.Empty),
                                html);

            return document;
        }
开发者ID:MikeEast,项目名称:pickles,代码行数:35,代码来源:HtmlDocumentFormatter.cs


示例3: VisitNodes

        private void VisitNodes(GeneralTree<INode> features, INode node)
        {
            if (node.IsIndexMarkDownNode())
            {
                return;
            }

            string nodePath = this.fileSystem.Path.Combine(this.configuration.OutputFolder.FullName, node.RelativePathFromRoot);
            string htmlFilePath;

            if (node.NodeType == NodeType.Content)
            {
                htmlFilePath = nodePath.Replace(this.fileSystem.Path.GetExtension(nodePath), ".html");
                this.WriteContentNode(features, node, htmlFilePath);
           }
            else if (node.NodeType == NodeType.Structure)
            {
                this.fileSystem.Directory.CreateDirectory(nodePath);

                htmlFilePath = this.fileSystem.Path.Combine(nodePath, "index.html");
                this.WriteContentNode(features, node, htmlFilePath);
            }
            else
            {
                // copy file from source to output
                this.fileSystem.File.Copy(node.OriginalLocation.FullName, nodePath, overwrite: true);
            }
        }
开发者ID:Jaykul,项目名称:pickles,代码行数:28,代码来源:HtmlDocumentationBuilder.cs


示例4: Build

        public void Build(GeneralTree<INode> features)
        {
            if (Log.IsInfoEnabled)
            {
                Log.Info("Writing Excel workbook to {0}", this.configuration.OutputFolder.FullName);
            }

            string spreadsheetPath = this.fileSystem.Path.Combine(this.configuration.OutputFolder.FullName, "features.xlsx");
            using (var workbook = new XLWorkbook())
            {
                var actionVisitor = new ActionVisitor<INode>(node =>
                {
                    var featureDirectoryTreeNode =
                        node as FeatureNode;
                    if (featureDirectoryTreeNode != null)
                    {
                        IXLWorksheet worksheet =
                            workbook.AddWorksheet(
                                this.excelSheetNameGenerator.GenerateSheetName(
                                    workbook,
                                    featureDirectoryTreeNode
                                        .Feature));
                        this.excelFeatureFormatter.Format(
                            worksheet,
                            featureDirectoryTreeNode.Feature);
                    }
                });

                features.AcceptVisitor(actionVisitor);

                this.excelTableOfContentsFormatter.Format(workbook, features);

                workbook.SaveAs(spreadsheetPath);
            }
        }
开发者ID:vavavivi,项目名称:pickles,代码行数:35,代码来源:ExcelDocumentationBuilder.cs


示例5: BuildListItems

        private XElement BuildListItems(GeneralTree<IDirectoryTreeNode> features)
        {
            XElement container;
            if (features.Data.IsContent)
            {
                container = new XElement("topicref",
                                         new XAttribute("href",
                                                        this.ditaMapPathGenerator.GeneratePathToFeature(features.Data)));
            }
            else
            {
                container = new XElement("topichead", new XAttribute("navtitle", features.Data.Name));
            }

            foreach (var childNode in features.ChildNodes)
            {
                if (childNode.Data.IsContent)
                {
                    container.Add(new XElement("topicref",
                                               new XAttribute("href",
                                                              this.ditaMapPathGenerator.GeneratePathToFeature(childNode.Data))));
                }
                else
                {
                    container.Add(this.BuildListItems(childNode));
                }
            }

            return container;
        }
开发者ID:timblinkbox,项目名称:pickles,代码行数:30,代码来源:DitaMapBuilder.cs


示例6: AddNodeForFile

        private XElement AddNodeForFile(XNamespace xmlns, Uri file, GeneralTree<INode> childNode)
        {
            var xElement = new XElement(xmlns + "li", new XAttribute("class", "file"));

            string nodeText = childNode.Data.Name;
            if (childNode.Data.OriginalLocationUrl == file)
            {
                xElement.Add(new XElement(xmlns + "span", new XAttribute("class", "current"), nodeText));
            }
            else
            {
                xElement.Add(new XElement(xmlns + "a", new XAttribute("href", childNode.Data.GetRelativeUriTo(file)),
                                          nodeText));
            }

              var featureNode = childNode.Data as FeatureNode;
              if (featureNode != null && this.imageResultFormatter != null)
              {
            Feature feature = featureNode.Feature;

            XElement formatForToC = this.imageResultFormatter.FormatForToC(feature);

            if (formatForToC != null)
            {
              xElement.Add(formatForToC);
            }
              }

              return xElement;
        }
开发者ID:pianovelty,项目名称:pickles,代码行数:30,代码来源:HtmlTableOfContentsFormatter.cs


示例7: Simple

        public void Simple()
        {
            var root = new GeneralTree<int>(5);

            var child1 = new GeneralTree<int>(2);
            var child2 = new GeneralTree<int>(3);
            var child3 = new GeneralTree<int>(1);

            root.Add(child1);
            root.Add(child2);
            root.Add(child3);

            var child4 = new GeneralTree<int>(9);
            var child5 = new GeneralTree<int>(12);
            var child6 = new GeneralTree<int>(13);

            child1.Add(child4);
            child1.Add(child5);
            child2.Add(child6);

            Assert.AreEqual(root.FindNode(target => target == 13), child6);

            Assert.AreEqual(root.FindNode(target => target == 2), child1);

            Assert.AreEqual(root.FindNode(target => target == 9), child4);

            Assert.AreEqual(root.FindNode(target => target == 57), null);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:28,代码来源:FindNode.cs


示例8: ApplyTestResultsToFeatures

        private static void ApplyTestResultsToFeatures(IContainer container, IConfiguration configuration, GeneralTree<INode> features)
        {
            var testResults = container.Resolve<ITestResults>();

            var actionVisitor = new ActionVisitor<INode>(node =>
            {
                var featureTreeNode = node as FeatureNode;
                if (featureTreeNode == null)
                {
                    return;
                }

                if (configuration.HasTestResults)
                {
                    SetResultsAtFeatureLevel(featureTreeNode, testResults);
                    SetResultsForIndividualScenariosUnderFeature(featureTreeNode, testResults);
                }
                else
                {
                    featureTreeNode.Feature.Result = TestResult.Inconclusive;
                }
            });

            features.AcceptVisitor(actionVisitor);
        }
开发者ID:MikeThomas64,项目名称:pickles,代码行数:25,代码来源:Runner.cs


示例9: Crawl

        private GeneralTree<IDirectoryTreeNode> Crawl(DirectoryInfo directory, IDirectoryTreeNode rootNode)
        {
            IDirectoryTreeNode currentNode =
                featureNodeFactory.Create(rootNode != null ? rootNode.OriginalLocation : null, directory);

            if (rootNode == null)
            {
                rootNode = currentNode;
            }

            var tree = new GeneralTree<IDirectoryTreeNode>(currentNode);

            bool isRelevantFileFound = false;
            foreach (FileInfo file in directory.GetFiles().Where(file => relevantFileDetector.IsRelevant(file)))
            {
                isRelevantFileFound = true;
                IDirectoryTreeNode node = featureNodeFactory.Create(rootNode.OriginalLocation, file);
                tree.Add(node);
            }

            bool isRelevantDirectoryFound = false;
            foreach (DirectoryInfo subDirectory in directory.GetDirectories())
            {
                GeneralTree<IDirectoryTreeNode> subTree = Crawl(subDirectory, rootNode);
                if (subTree != null)
                {
                    isRelevantDirectoryFound = true;
                    tree.Add(subTree);
                }
            }

            if (!isRelevantFileFound && !isRelevantDirectoryFound) return null;

            return tree;
        }
开发者ID:chfj,项目名称:pickles,代码行数:35,代码来源:DirectoryTreeCrawler.cs


示例10: Format

        public XDocument Format(IDirectoryTreeNode featureNode, GeneralTree<IDirectoryTreeNode> features, DirectoryInfo rootFolder)
        {
            var xmlns = HtmlNamespace.Xhtml;
            var featureNodeOutputPath = Path.Combine(this.configuration.OutputFolder.FullName, featureNode.RelativePathFromRoot);
            var featureNodeOutputUri = new Uri(featureNodeOutputPath);

            var container = new XElement(xmlns + "div", new XAttribute("id", "container"));
            container.Add(this.htmlHeaderFormatter.Format());
            container.Add(this.htmlTableOfContentsFormatter.Format(featureNode.OriginalLocationUrl, features, rootFolder));
            container.Add(this.htmlContentFormatter.Format(featureNode, features));
            container.Add(this.htmlFooterFormatter.Format());

            var body = new XElement(xmlns + "body");
            body.Add(container);

            var head = new XElement(xmlns + "head");
            head.Add(new XElement(xmlns + "title", string.Format("{0}", featureNode.Name)));

            head.Add(new XElement(xmlns + "link",
                         new XAttribute("rel", "stylesheet"),
                         new XAttribute("href", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.MasterStylesheet)),
                         new XAttribute("type", "text/css")));

            head.Add(new XElement(xmlns + "link",
                         new XAttribute("rel", "stylesheet"),
                         new XAttribute("href", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.PrintStylesheet)),
                         new XAttribute("type", "text/css"),
                         new XAttribute("media", "print")));

            head.Add(new XElement(xmlns + "script",
                         new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.jQueryScript)),
                         new XAttribute("type", "text/javascript"),
                         new XText(string.Empty)));

            head.Add(new XElement(xmlns + "script",
                         new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.jQueryDataTablesScript)),
                         new XAttribute("type", "text/javascript"),
                         new XText(string.Empty)));

            head.Add(new XElement(xmlns + "script",
                         new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.AdditionalScripts)),
                         new XAttribute("type", "text/javascript"),
                         new XText(string.Empty)));

            head.Add(new XElement(xmlns + "script",
                         new XAttribute("type", "text/javascript"),
                         documentReady));

            var html = new XElement(xmlns + "html",
                           new XAttribute(XNamespace.Xml + "lang", "en"),
                           head,
                           body);

            var document = new XDocument(
                                new XDeclaration("1.0", "UTF-8", null),
                                new XDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", string.Empty),
                                html);

            return document;
        }
开发者ID:drift,项目名称:pickles,代码行数:60,代码来源:HtmlDocumentFormatter.cs


示例11: BuildListItems

        private XElement BuildListItems(XNamespace xmlns, Uri file, GeneralTree<FeatureNode> features)
        {
            var ul = new XElement(xmlns + "ul", new XAttribute("class", "features"));

            foreach (var childNode in features.ChildNodes)
            {
                if (childNode.Data.IsContent)
                {
                    ul.Add(new XElement(xmlns + "div",
                               new XAttribute("class", "file"),
                               new XElement(xmlns + "li",
                                   new XElement(xmlns + "a",
                                       new XAttribute("href", childNode.Data.GetRelativeUriTo(file)), childNode.Data.Name.ExpandWikiWord()))));
                }
                else
                {
                    ul.Add(new XElement(xmlns + "li",
                               new XElement(xmlns + "div",
                                   new XAttribute("class", "directory"),
                                   new XText(childNode.Data.Name.ExpandWikiWord())
                               ), BuildListItems(xmlns, file, childNode)));
                }
            }

            return ul;
        }
开发者ID:MikeEast,项目名称:pickles,代码行数:26,代码来源:HtmlTableOfContentsFormatter.cs


示例12: Build

        public void Build(GeneralTree<IDirectoryTreeNode> features)
        {
            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Writing DHTML files to {0}", this.configuration.OutputFolder.FullName);
            }

            var resource = new DhtmlResourceSet(configuration);

            log.Info("DeployZippedDhtmlResourcesForExtraction");
            DeployZippedDhtmlResourcesForExtraction(resource);

            log.Info("UnzipDhtmlResources");
            UnzipDhtmlResources(resource);
            
            log.Info("UtilizeJsonBuilderToDumpJsonFeatureFileNextToDthmlResources");
            UtilizeJsonBuilderToDumpJsonFeatureFileNextToDthmlResources(features);

            log.Info("Tweak Json file");
            TweakJsonFile();

            log.Info("CleanupZippedDhtmlResources");
            CleanupZippedDhtmlResources(resource);

        }
开发者ID:hotgazpacho,项目名称:pickles,代码行数:25,代码来源:DhtmlDocumentationBuilder.cs


示例13: Simple

        public void Simple()
        {
            var generalTree = new GeneralTree<int>(4);
            Assert.IsFalse(generalTree.IsReadOnly);

            generalTree = GetTestTree();
            Assert.IsFalse(generalTree.IsReadOnly);
        }
开发者ID:havok,项目名称:ngenerics,代码行数:8,代码来源:IsReadOnly.cs


示例14: Build

 public void Build(GeneralTree<IDirectoryTreeNode> features)
 {
     var map = new XElement("map", new XAttribute("title", "Features"), new XAttribute("id", "features"),
                            this.BuildListItems(features));
     var document = new XDocument(
         new XDocumentType("map", "-//OASIS//DTD DITA Map//EN", "map.dtd", string.Empty), map);
     document.Save(Path.Combine(this.configuration.OutputFolder.FullName, "features.ditamap"));
 }
开发者ID:timblinkbox,项目名称:pickles,代码行数:8,代码来源:DitaMapBuilder.cs


示例15: Get

        public void Get()
        {
            var root = new GeneralTree<int>(5) { 2, 3 };

            root.GetChild(0).Parent = root.GetChild(1);

            Assert.AreSame(((ITree<int>)root.GetChild(0)).Parent, root);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:8,代码来源:Parent.cs


示例16: IHaveThisFeatureDescription

        public void IHaveThisFeatureDescription(string featureDescription)
        {
            FeatureParser parser = new FeatureParser(this.FileSystem);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new GeneralTree<INode>(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
开发者ID:vavavivi,项目名称:pickles,代码行数:8,代码来源:StepDefinitions.cs


示例17: ExceptionInvalidSubTreeNegative

        public void ExceptionInvalidSubTreeNegative()
        {
            var root = new GeneralTree<int>(5);
            var child1 = new GeneralTree<int>(2);

            root.Add(child1);
            root.GetChild(-1);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:8,代码来源:GetChild.cs


示例18: Format

        public XElement Format(Uri file, GeneralTree<FeatureNode> features)
        {
            var xmlns = XNamespace.Get("http://www.w3.org/1999/xhtml");

            return new XElement(xmlns + "div",
                       new XAttribute("id", "toc"),
                       BuildListItems(xmlns, file, features)
                   );
        }
开发者ID:MikeEast,项目名称:pickles,代码行数:9,代码来源:HtmlTableOfContentsFormatter.cs


示例19: Simple

        public void Simple()
        {
            var root = new GeneralTree<int>(5);

            var child1 = new GeneralTree<int>(2);
            var child2 = new GeneralTree<int>(3);
            var child3 = new GeneralTree<int>(5);
            var child4 = new GeneralTree<int>(7);

            root.Add(child1);
            root.Add(child2);

            Assert.AreEqual(root.Count, 2);
            Assert.AreEqual(root.Degree, 2);

            root.RemoveAt(0);

            Assert.IsNull(child1.Parent);

            Assert.AreEqual(root.Count, 1);
            Assert.AreEqual(root.Degree, 1);
            Assert.AreEqual(root.GetChild(0), child2);
            Assert.AreEqual(root.GetChild(0).Data, 3);

            root.Add(child1);

            Assert.AreEqual(child1.Parent, root);
            Assert.AreEqual(root.Count, 2);
            Assert.AreEqual(root.Degree, 2);

            Assert.IsTrue(root.Remove(child1));
            Assert.IsNull(child1.Parent);

            Assert.AreEqual(root.Count, 1);
            Assert.AreEqual(root.Degree, 1);
            Assert.AreEqual(root.GetChild(0), child2);
            Assert.AreEqual(root.GetChild(0).Data, 3);

            Assert.IsFalse(root.Remove(child3));

            root.Add(child3);
            root.Add(child4);

            Assert.AreEqual(root.Count, 3);
            Assert.AreEqual(root.Degree, 3);

            var fiveNode = root.FindNode(target => target == 5);
            Assert.IsTrue(root.Remove(5));

            Assert.IsNull(fiveNode.Parent);

            Assert.AreEqual(root.Count, 2);
            Assert.AreEqual(root.Degree, 2);
            Assert.AreEqual(root.GetChild(1).Data, 7);

            Assert.IsFalse(root.Remove(13));
        }
开发者ID:havok,项目名称:ngenerics,代码行数:57,代码来源:Remove.cs


示例20: IHaveThisFeatureDescription

        public void IHaveThisFeatureDescription(string featureDescription)
        {
            var configuration = this.Container.Resolve<IConfiguration>();
            FeatureParser parser = new FeatureParser(this.FileSystem, configuration);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new GeneralTree<INode>(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
开发者ID:iamkoch,项目名称:pickles,代码行数:9,代码来源:StepDefinitions.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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