Allow multiple enum values to be parsed from yaml with the same syntax as a string[].
This commit is contained in:
@@ -263,10 +263,15 @@ namespace OpenRA
|
||||
|
||||
else if (fieldType.IsEnum)
|
||||
{
|
||||
if (!Enum.GetNames(fieldType).Select(a => a.ToLower()).Contains(value.ToLower()))
|
||||
return InvalidValueAction(value, fieldType, fieldName);
|
||||
try
|
||||
{
|
||||
return Enum.Parse(fieldType, value, true);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
return InvalidValueAction(value, fieldType, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
else if (fieldType == typeof(bool))
|
||||
return ParseYesNo(value, fieldType, fieldName);
|
||||
|
||||
Reference in New Issue
Block a user