public IEnumerable <SFieldResult> Fields(bool includeBaseTypes) { if (includeBaseTypes && this.baseTypes != null) { foreach (SBaseType baseType in this.baseTypes) { foreach (SFieldResult innerBaseField in baseType.Type.Fields(includeBaseTypes: true)) { SFieldResult baseField = innerBaseField; baseField.Offset = (uint)(baseField.Offset + baseType.Offset); yield return(baseField); } } } if (this.fields != null) { foreach (string fieldName in this.fields.Keys) { SField innerField = this.fields[fieldName]; SFieldResult field = new SFieldResult(); field.FieldName = fieldName; field.Module = innerField.Module; field.TypeName = innerField.TypeName; field.Offset = innerField.Offset; field.Size = innerField.Size; field.BitCount = innerField.BitCount; field.BitOffset = innerField.BitOffset; yield return(field); } } yield break; }
public bool GetField(string name, out SField field) { if (this.fields != null) { if (this.fields.ContainsKey(name)) { field = this.fields[name]; return(true); } else if (this.caseInsensitiveFields.ContainsKey(name.ToLowerInvariant())) { field = this.fields[this.caseInsensitiveFields[name.ToLowerInvariant()]]; return(true); } else if (this.baseTypes != null) { // Check the base types. foreach (SBaseType baseType in this.baseTypes) { if (baseType.Type.GetField(name, out field)) { field = new SField((uint)(field.Offset + baseType.Offset), field.Size, field.Module, field.TypeName, field.BitOffset, field.BitCount); return(true); } } } } field = new SField(); return(false); }