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


C# YamlSequenceNode.Add方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: UpgradeAsset

            protected override void UpgradeAsset(int currentVersion, int targetVersion, ILogger log, dynamic asset)
            {
                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:RxGamesLtd,项目名称:paradox,代码行数:14,代码来源:SceneAsset.cs


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