Allow multiple enum values to be parsed from yaml with the same syntax as a string[].
This commit is contained in:
@@ -263,9 +263,14 @@ namespace OpenRA
|
|||||||
|
|
||||||
else if (fieldType.IsEnum)
|
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 InvalidValueAction(value, fieldType, fieldName);
|
||||||
return Enum.Parse(fieldType, value, true);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (fieldType == typeof(bool))
|
else if (fieldType == typeof(bool))
|
||||||
|
|||||||
Reference in New Issue
Block a user