Allow multiple enum values to be parsed from yaml with the same syntax as a string[].

This commit is contained in:
Taryn
2014-04-30 07:15:09 -05:00
parent cb93e8cb70
commit e828541dc9

View File

@@ -263,9 +263,14 @@ namespace OpenRA
else if (fieldType.IsEnum)
{
if (!Enum.GetNames(fieldType).Select(a => a.ToLower()).Contains(value.ToLower()))
try
{
return Enum.Parse(fieldType, value, true);
}
catch (ArgumentException)
{
return InvalidValueAction(value, fieldType, fieldName);
return Enum.Parse(fieldType, value, true);
}
}
else if (fieldType == typeof(bool))