mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Allow parsing enum values if property is enum
Can now search `=Gender=Genderless` for filtering PLA encounter slots
This commit is contained in:
parent
2a6026cc80
commit
53e99ee238
1 changed files with 7 additions and 0 deletions
|
@ -80,6 +80,13 @@ namespace PKHeX.Core
|
|||
: null;
|
||||
}
|
||||
|
||||
if (type.IsEnum)
|
||||
{
|
||||
var str = value.ToString();
|
||||
if (int.TryParse(str, out var integer))
|
||||
return Convert.ChangeType(integer, type);
|
||||
return Enum.Parse(type, str, true);
|
||||
}
|
||||
// Convert.ChangeType is suitable for most things
|
||||
return Convert.ChangeType(value, type);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue