public static BoxEnum FromPropertyInfo(PropertyInfo info) { BoxEnum e = new BoxEnum(); e.Name = info.PropertyType.Name; e.Values.AddRange(Enum.GetNames(info.PropertyType)); return(e); }
/// <summary> /// Processes a type and collects information about its properties /// </summary> /// <param name="t">The Type to examine</param> private void ProcessType(Type t) { ArrayList list = new ArrayList(); if ((BoxUtil.IsItem(t) || BoxUtil.IsMobile(t))) { PropertyInfo[] props = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); if (props.Length > 0) { foreach (PropertyInfo info in props) { BoxProp p = BoxProp.FromPropertyInfo(info); if (p != null) { list.Add(p); if (p.ValueType == BoxPropType.Enumeration) { if (!EnumListed(p.EnumName)) { BoxEnum e = BoxEnum.FromPropertyInfo(info); m_Enums.Add(e); } } } } } } if (list.Count > 0) { m_Constructables[t.Name] = list; } else { m_Constructables[t.Name] = null; } }
public static BoxEnum FromPropertyInfo( PropertyInfo info ) { BoxEnum e = new BoxEnum(); e.Name = info.PropertyType.Name; e.Values.AddRange( Enum.GetNames( info.PropertyType ) ); return e; }