Further fixes
This commit is contained in:
parent
f98750212c
commit
2e3b7d9c2e
6 changed files with 39 additions and 15 deletions
|
|
@ -59,6 +59,14 @@ namespace AuroraRecordGenerator
|
|||
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
|
||||
return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species);
|
||||
}
|
||||
|
||||
public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename)
|
||||
{
|
||||
return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
|
||||
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
|
||||
where attr != null && attr.NiceName == nicename
|
||||
select item).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
// From https://stackoverflow.com/questions/1799370/getting-attributes-of-enums-value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue