private static void ExtractCollectionField(IMapCategory parent) { foreach (var mainProperty in GetProperties <InfoArrayCategoryAttribute>(parent.OwnerType)) { InfoArrayCategoryAttribute attribute = GetAttribute <InfoArrayCategoryAttribute>(mainProperty); MapCategory mapCategory = new CollectionMapCategory(parent, attribute, mainProperty); parent.AddCategory(mapCategory); } }
private void ProcessType(IMapCategory parent) { foreach (var mainProperty in GetProperties <InfoCategoryAttribute>(parent.OwnerType)) { InfoCategoryAttribute attribute = GetAttribute <InfoCategoryAttribute>(mainProperty); if (attribute.Ignore) { continue; } MapCategory mapCategory = new ChildMapCategory(parent, attribute.Name, mainProperty); mapCategory.IsCollapsed = attribute.IsCollapsed; parent.AddCategory(mapCategory); ProcessType(mapCategory); } ExtractField(parent); ExtractCollectionField(parent); }
private static void ExtractField(IMapCategory parent) { foreach (var fieldProperty in GetProperties <InfoFieldAttribute>(parent.OwnerType)) { var ignore = GetAttribute <IgnoreAttribute>(fieldProperty); if (ignore != null) { continue; } InfoFieldAttribute attribute = GetAttribute <InfoFieldAttribute>(fieldProperty); if (fieldProperty.PropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(fieldProperty.PropertyType)) { var mapCategory = new EnumerableMapCategory(parent, attribute.Name, fieldProperty); parent.AddCategory(mapCategory); } else { parent.AddField(new MapField(parent, attribute, fieldProperty)); } } }