private static void _initializeTypeProperties( Type type, Dictionary<string, IPropertyCommand> list )
{
// Load the IPropertyCommands from the parent Type
Type parent = type.BaseType;
if ( parent != typeof( System.Object ) )
{
foreach ( KeyValuePair<string, IPropertyCommand> item in _getTypePropertyMap( parent ) )
{
list.Add( item.Key, item.Value );
}
parent = parent.BaseType;
}
foreach ( Type nestType in type.GetNestedTypes( BindingFlags.NonPublic | BindingFlags.Public ) )
{
#if !(XBOX || XBOX360)
if ( nestType.FindInterfaces( delegate( Type typeObj, Object criteriaObj )
{
if ( typeObj.ToString() == criteriaObj.ToString() )
return true;
else
return false;
}
, typeof( IPropertyCommand ).FullName ).Length != 0 )
{
foreach ( ScriptablePropertyAttribute attr in nestType.GetCustomAttributes( typeof( ScriptablePropertyAttribute ), true ) )
{
IPropertyCommand propertyCommand = (IPropertyCommand)Activator.CreateInstance( nestType );
list.Add( attr.ScriptPropertyName, propertyCommand );
}
}
#else
foreach ( Type iface in nestType.GetInterfaces() )
{
if ( iface.FullName == typeof(IPropertyCommand).FullName )
{
foreach (ScriptablePropertyAttribute attr in nestType.GetCustomAttributes(typeof(ScriptablePropertyAttribute), true))
{
IPropertyCommand propertyCommand = (IPropertyCommand)Activator.CreateInstance(nestType);
list.Add(attr.ScriptPropertyName, propertyCommand);
}
}
}
#endif
}
}