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

C# YamlSequenceNode类代码示例

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

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



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

示例1: ParsesCruiseControlServerCorrectly

        public void ParsesCruiseControlServerCorrectly()
        {
            var kernel = new StandardKernel();

            var parser = kernel.Get<CruiseControlConfigParser>();

            kernel.Bind<ITimer>().ToConstant(new Mock<ITimer>().Object);
            kernel.Bind<IParser>().ToConstant(new Mock<IParser>().Object).Named("CruiseControl");

            var config = new YamlMappingNode
                             {
                                 {"url", "http://goserver.localdomain:8153/go/cctray.xml"},
                                 {"username", "ci"},
                                 {"password", "secret"}
                             };
            var pipeline1 = new YamlMappingNode {{"name", "Cosby-Kid"}};
            var pipeline2 = new YamlMappingNode { { "name", "Family-Tieman" } };
            var pipelines = new YamlSequenceNode {pipeline1, pipeline2};
            config.Add("pipelines",pipelines);

            var cruiseControlServer = parser.Parse(config) as CruiseControlServer;
            Assert.IsNotNull(cruiseControlServer);
            Assert.IsNotNull(cruiseControlServer.Config);
            var cruiseControlServerconfig = cruiseControlServer.Config;
            Assert.AreEqual("http://goserver.localdomain:8153/go/cctray.xml", cruiseControlServerconfig.URL);
            Assert.AreEqual("ci", cruiseControlServerconfig.Username);
            Assert.AreEqual("secret", cruiseControlServerconfig.Password);
            Assert.IsNotNull(cruiseControlServerconfig.Pipelines);
            Assert.AreEqual(2, cruiseControlServerconfig.Pipelines.Count());
        }
开发者ID:thenathanjones,项目名称:burro,代码行数:30,代码来源:CruiseControlConfigParserTest.cs


示例2: GetUpdateAttribute

        private static Tuple<string, YamlNode> GetUpdateAttribute(JProperty prop)
        {
            var propValueType = prop.Value.Type;
            var value = string.Empty;

            if (propValueType == JTokenType.Object || propValueType == JTokenType.Array)
            {
                if (propValueType == JTokenType.Array)
                {
                    var nodes = new YamlSequenceNode();
                    foreach(var item in prop.Value as JArray)
                    {
                        var asset = new Asset(item as dynamic);
                        var yamlNode = GetNodes(asset);
                        nodes.Add(yamlNode);
                    }
                    return new Tuple<string, YamlNode>(prop.Name, nodes);
                }

                return new Tuple<string, YamlNode>(prop.Name, new YamlScalarNode(string.Empty));
            }
            else
            {
                value = (prop.Value as JValue).Value.ToString();
                return new Tuple<string, YamlNode>(prop.Name, new YamlScalarNode(value));
            }
        }
开发者ID:JogoShugh,项目名称:VersionOneRestSharpClient,代码行数:27,代码来源:QueryYamlPayloadBuilder.cs


示例3: ParsesTeamCityServerCorrectly

        public void ParsesTeamCityServerCorrectly()
        {
            var kernel = new StandardKernel();

            var parser = kernel.Get<TeamCityConfigParser>();

            kernel.Bind<ITimer>().ToConstant(new Mock<ITimer>().Object);
            kernel.Bind<IParser>().ToConstant(new Mock<IParser>().Object).Named("TeamCity");

            var config = new YamlMappingNode
                             {
                                 {"url", "http://localhost"},
                                 {"username", "ci"},
                                 {"password", "secret"}
                             };
            var pipeline1 = new YamlMappingNode {{"name", "bt1"}};
            var pipeline2 = new YamlMappingNode { { "name", "bt2" } };
            var pipelines = new YamlSequenceNode {pipeline1, pipeline2};
            config.Add("pipelines",pipelines);

            var teamCityServer = parser.Parse(config) as TeamCityServer;
            Assert.IsNotNull(teamCityServer);
            Assert.IsNotNull(teamCityServer.Config);
            var teamCityServerConfig = teamCityServer.Config;
            Assert.AreEqual("http://localhost", teamCityServerConfig.URL);
            Assert.AreEqual("ci", teamCityServerConfig.Username);
            Assert.AreEqual("secret", teamCityServerConfig.Password);
            Assert.IsNotNull(teamCityServerConfig.Pipelines);
            Assert.AreEqual(2, teamCityServerConfig.Pipelines.Count());
        }
开发者ID:thenathanjones,项目名称:burro,代码行数:30,代码来源:TeamCityConfigParserTest.cs


示例4: YamlSequenceNodeValueConverter

 public YamlSequenceNodeValueConverter(YamlSequenceNode parent, Type globalType, string label, MemberInfo memberInfo)
 {
     this.parentNode = parent;
     this.globalType = globalType;
     this.label = label;
     this.memberInfo = memberInfo;
 }
开发者ID:stuart-bennett,项目名称:Fixtya,代码行数:7,代码来源:YamlSequenceNodeValueConverter.cs


示例5: FindSequence

        private YamlNode FindSequence(YamlSequenceNode node, string key, object value)
        {
            if (this.IsError) return null;

            foreach (var child in node.Children)
            {
                var mapping = (YamlMappingNode) child;
                foreach (var mappingChild in mapping.Children)
                {
                    if (mappingChild.Key.ToString() == key)
                    {
                        // Found key, check value, otherwise skip this mappingChild
                        if (mappingChild.Value.ToString() == value.ToString())
                        {
                            // Value matches, return mapping
                            return mapping;
                        }
                        else
                        {
                            // Value does not match, skip this child
                            break;
                        }
                    }
                }
            }
            return null;
        }
开发者ID:mochablendy,项目名称:iRacingSdkWrapper,代码行数:27,代码来源:YamlQuery.cs


示例6: VisitYamlSequenceNode

 private void VisitYamlSequenceNode(YamlSequenceNode yamlNode)
 {
     foreach (var entry in yamlNode.Children)
     {
         if (entry is YamlMappingNode)
             VisitYamlMappingNode((YamlMappingNode)entry);
     }
 }
开发者ID:adwardliu,项目名称:Orchard2,代码行数:8,代码来源:YamlConfigurationFileParser.cs


示例7: GetKeyShortcuts

 static IEnumerable<KeyShortcut> GetKeyShortcuts(YamlSequenceNode groupShortcuts)
 {
     return from entry in groupShortcuts.Children.OfType<YamlMappingNode>()
            from keys in entry.Children.Where(n => n.Key.ToString() == "keys").Take(1).Select(x=>x.Value).OfType<YamlSequenceNode>()
            let name = GetValueByKey(entry, "name")
            from definitions in keys.Children.Select(KeyPressDefinitions).Where(definitions => definitions.Count > 0)
            select new KeyShortcut(name, definitions.ToArray());
 }
开发者ID:bihai,项目名称:carnac,代码行数:8,代码来源:ShortcutProvider.cs


示例8: Visit

        protected override void Visit(YamlSequenceNode sequence)
        {
            var nestedVisitor = new ContextAwareSequenceVisitor(context);
            sequence.Accept(nestedVisitor);

            foreach (var item in nestedVisitor.Items)
            {
                this.items.Add(new KeyValuePair<string, string>(item.Key, item.Value));
            }
        }
开发者ID:nbarbettini,项目名称:FlexibleConfiguration,代码行数:10,代码来源:ContextAwareVisitor.cs


示例9: Load

 public void Load(YamlSequenceNode CountriesNode)
 {
   foreach( YamlNode childSeq in CountriesNode.Children )
   {
     if( childSeq is YamlMappingNode )
     {
       CountryList.Add( new Country( (YamlMappingNode)childSeq ) );
     }
   }
 }
开发者ID:pmprog,项目名称:OpenXCOM.Tools,代码行数:10,代码来源:Countries.cs


示例10: YamlQuery

        protected YamlQuery(YamlQuery parent, bool error, YamlSequenceNode root, string key, object value)
        {
            _path = parent == null ? "" : parent.QueryPath;
            _path += string.Format("{0}:{{{1}}}", key, value);

            // Find sequencing node with matching value
            this.IsError = error;
            if (!error)
            {
                // Find next mapping node
                this.Node = FindSequence(root, key, value);
            }
        }
开发者ID:dbanshee,项目名称:ArduinoRacingDash,代码行数:13,代码来源:YamlQuery.cs


示例11: VisitChildren

        protected override void VisitChildren(YamlSequenceNode sequence)
        {
            foreach (var node in sequence.Children)
            {
                this.EnterContext(index.ToString());

                var visitor = new ContextAwareVisitor(context);
                node.Accept(visitor);
                this.items.AddRange(visitor.Items);

                this.ExitContext();
                index++;
            }
        }
开发者ID:nbarbettini,项目名称:FlexibleConfiguration,代码行数:14,代码来源:ContextAwareSequenceVisitor.cs


示例12: parseList

        public static FilterCollection parseList(YamlSequenceNode list, Dictionary<string, Filter> filterMap)
        {
            FilterCollection collection = new FilterCollection();

            if (list != null)
            {
                foreach (YamlNode node in list.Children)
                {
                    parseFilterNode(collection, filterMap, node);
                }
            }

            return collection;
        }
开发者ID:pschichtel,项目名称:LyricsReloaded,代码行数:14,代码来源:FilterCollection.cs


示例13: parseList

        public static ValidationCollection parseList(YamlSequenceNode list, Dictionary<string, Validator> validatorMap)
        {
            ValidationCollection collection = new ValidationCollection();

            if (list != null)
            {
                foreach (YamlNode node in list.Children)
                {
                    parseFilterNode(collection, validatorMap, node);
                }
            }

            return collection;
        }
开发者ID:pschichtel,项目名称:LyricsReloaded,代码行数:14,代码来源:ValidationCollection.cs


示例14: Reload

		public void Reload(YamlNode node)
		{
			yamlNode = node;
			mappingNode = yamlNode as YamlMappingNode;
			sequenceNode = yamlNode as YamlSequenceNode;
			scalarNode = yamlNode as YamlScalarNode;
			children = null;
		}
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:DynamicYaml.cs


示例15: UpgradeAsset

            protected override void UpgradeAsset(AssetMigrationContext context, int currentVersion, int targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
            {
                var entities = asset.Hierarchy.Entities;
                var designEntities = new YamlSequenceNode();
                asset.Hierarchy.Entities = designEntities;

                foreach (var entity in entities)
                {
                    var designEntity = new YamlMappingNode();
                    dynamic dynamicDesignEntity = new DynamicYamlMapping(designEntity);
                    dynamicDesignEntity.Entity = entity;
                    designEntities.Add(designEntity);
                }
            }
开发者ID:releed,项目名称:paradox,代码行数:14,代码来源:SceneAsset.cs


示例16: DynamicYamlArray

 public DynamicYamlArray(YamlSequenceNode node)
 {
     this.node = node;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:4,代码来源:DynamicYamlArray.cs


示例17: Visit

		protected override void Visit(YamlSequenceNode sequence)
		{
			WriteIndent();
			Console.WriteLine("Visit(YamlSequenceNode, {0}, {1})", sequence.Anchor, sequence.Tag);
			indent++;
		}
开发者ID:Gwynneth,项目名称:YamlDotNet,代码行数:6,代码来源:VisitYamlStream.cs


示例18: Visited

		protected override void Visited(YamlSequenceNode sequence)
		{
			indent--;
			WriteIndent();
			Console.WriteLine("Visited(YamlSequenceNode)");
		}
开发者ID:Gwynneth,项目名称:YamlDotNet,代码行数:6,代码来源:VisitYamlStream.cs


示例19: Build

        private YamlNode Build()
        {
            var root = new YamlMappingNode();

            root.Add("from", _assetType);

            if (SelectFields.Count > 0)
            {
                var select = new YamlSequenceNode();

                var attributes = SelectFields.Where(s => s is string);
                foreach(var attr in attributes)
                {
                    var val = attr as string;
                    select.Add(val);
                }

                var nestedBuilders = SelectFields.Where(s => s is QueryApiQueryBuilder);
                foreach (var item in nestedBuilders)
                {
                    var nestedBuilder = item as QueryApiQueryBuilder;
                    select.Add(nestedBuilder.Build());
                }

                root.Add("select", select);
            }

            if (WhereCriteria.Count > 0)
            {
                var whereNodes = new YamlMappingNode();

                foreach (var criterion in WhereCriteria)
                {
                    whereNodes.Add(criterion.AttributeName, criterion.MatchValue.ToString());
                }

                root.Add("where", whereNodes);
            }

            if (FilterCriteria.Count > 0)
            {
                var filterNodes = new YamlSequenceNode();

                foreach (var criterion in FilterCriteria)
                {
                    filterNodes.Add($"{criterion.AttributeName}{criterion.Operator.Token}\"{criterion.MatchValue.ToString()}\"");
                }

                root.Add("filter", filterNodes);
            }

            return root;
        }
开发者ID:JogoShugh,项目名称:VersionOneRestSharpClient,代码行数:53,代码来源:QueryApiQueryBuilder.cs


示例20: Visit

 /// <summary>
 /// Called when this object is visiting a <see cref="YamlSequenceNode"/>.
 /// </summary>
 /// <param name="sequence">
 /// The <see cref="YamlSequenceNode"/> that is being visited.
 /// </param>
 public virtual void Visit(YamlSequenceNode sequence)
 {
     VisitChildren(sequence);
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:10,代码来源:YamlVisitorBase.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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