void ParseEnum(TypeDefinition enumTypeDef) { // TODO: verify that int32 is the enums storage type for constant read below InspectorEnum ienum = new InspectorEnum(); ienum.Name = metaReader.GetString(enumTypeDef.Name); InspectorEnums[ienum.Name] = ienum; var fields = enumTypeDef.GetFields(); foreach (var fieldHandle in fields) { var inspectorField = new InspectorField(); var fieldDef = metaReader.GetFieldDefinition(fieldHandle); if ((fieldDef.Attributes & FieldAttributes.HasDefault) != 0) { var constantHandle = fieldDef.GetDefaultValue(); var constant = metaReader.GetConstant(constantHandle); BlobReader constantReader = metaReader.GetBlobReader(constant.Value); ienum.Values[metaReader.GetString(fieldDef.Name)] = constantReader.ReadInt32(); } } return; }
void ParseEnum(TypeDefinition enumTypeDef) { // TODO: verify that int32 is the enums storage type for constant read below InspectorEnum ienum = new InspectorEnum (); ienum.Name = metaReader.GetString (enumTypeDef.Name); InspectorEnums [ienum.Name] = ienum; var fields = enumTypeDef.GetFields (); foreach (var fieldHandle in fields) { var inspectorField = new InspectorField (); var fieldDef = metaReader.GetFieldDefinition (fieldHandle); if ((fieldDef.Attributes & FieldAttributes.HasDefault) != 0) { var constantHandle = fieldDef.GetDefaultValue (); var constant = metaReader.GetConstant (constantHandle); BlobReader constantReader = metaReader.GetBlobReader (constant.Value); ienum.Values [metaReader.GetString (fieldDef.Name)] = constantReader.ReadInt32 (); } } return; }