本文整理汇总了C#中YamlSequenceNode类的典型用法代码示例。如果您正苦于以下问题:C# YamlSequenceNode类的具体用法?C# YamlSequenceNode怎么用?C# YamlSequenceNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
YamlSequenceNode类属于命名空间,在下文中一共展示了YamlSequenceNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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));
}
}
示例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());
}
示例4: YamlSequenceNodeValueConverter
public YamlSequenceNodeValueConverter(YamlSequenceNode parent, Type globalType, string label, MemberInfo memberInfo)
{
this.parentNode = parent;
this.globalType = globalType;
this.label = label;
this.memberInfo = memberInfo;
}
示例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;
}
示例6: VisitYamlSequenceNode
private void VisitYamlSequenceNode(YamlSequenceNode yamlNode)
{
foreach (var entry in yamlNode.Children)
{
if (entry is YamlMappingNode)
VisitYamlMappingNode((YamlMappingNode)entry);
}
}
示例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());
}
示例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));
}
}
示例9: Load
public void Load(YamlSequenceNode CountriesNode)
{
foreach( YamlNode childSeq in CountriesNode.Children )
{
if( childSeq is YamlMappingNode )
{
CountryList.Add( new Country( (YamlMappingNode)childSeq ) );
}
}
}
示例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);
}
}
示例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++;
}
}
示例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;
}
示例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;
}
示例14: Reload
public void Reload(YamlNode node)
{
yamlNode = node;
mappingNode = yamlNode as YamlMappingNode;
sequenceNode = yamlNode as YamlSequenceNode;
scalarNode = yamlNode as YamlScalarNode;
children = null;
}
示例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);
}
}