本文整理汇总了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));
}
}
示例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);
}
}
示例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;
}
示例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);
}
}