public void Deserialize(Map map, List<MiniYamlNode> nodes)
{
var node = nodes.FirstOrDefault(n => n.Key == key);
if (node == null)
{
if (required)
throw new YamlException("Required field `{0}` not found in map.yaml".F(key));
return;
}
if (field != null)
{
if (type == Type.NodeList)
field.SetValue(map, node.Value.Nodes);
else if (type == Type.MiniYaml)
field.SetValue(map, node.Value);
else
FieldLoader.LoadField(map, fieldName, node.Value.Value);
}
if (property != null)
{
if (type == Type.NodeList)
property.SetValue(map, node.Value.Nodes, null);
else if (type == Type.MiniYaml)
property.SetValue(map, node.Value, null);
else
FieldLoader.LoadField(map, fieldName, node.Value.Value);
}
}