public TypeCache( Assembly asm )
{
if( asm == null )
m_Types = Type.EmptyTypes;
else
m_Types = asm.GetTypes();
m_Names = new TypeTable( m_Types.Length );
m_FullNames = new TypeTable( m_Types.Length );
Type typeofTypeAliasAttribute = typeof( TypeAliasAttribute );
for( int i = 0; i < m_Types.Length; ++i )
{
Type type = m_Types[i];
m_Names.Add( type.Name, type );
m_FullNames.Add( type.FullName, type );
if( type.IsDefined( typeofTypeAliasAttribute, false ) )
{
object[] attrs = type.GetCustomAttributes( typeofTypeAliasAttribute, false );
if( attrs != null && attrs.Length > 0 )
{
TypeAliasAttribute attr = attrs[0] as TypeAliasAttribute;
if( attr != null )
{
for( int j = 0; j < attr.Aliases.Length; ++j )
m_FullNames.Add( attr.Aliases[j], type );
}
}
}
}
}
}