public Library(Config.Library libConfig, Assembly _assembly)
{
name = libConfig.Name;
assembly = _assembly;
ArrayList typeList = new ArrayList();
assembly.GetTypes();
foreach (Type type in assembly.GetTypes()) {
if (libConfig == null || !libConfig.GetIgnoreType(type))
typeList.Add(type);
}
types = (Type[])typeList.ToArray(typeof(Type));
typesByName = new TypeTable(types.Length);
typesByFullName = new TypeTable(types.Length);
Type typeofTypeAliasAttribute = typeof(TypeAliasAttribute);
foreach (Type type in types) {
typesByName.Add(type.Name, type);
typesByFullName.Add(type.FullName, type);
if (type.IsDefined(typeofTypeAliasAttribute, false)) {
object[] attrs = type.GetCustomAttributes(typeofTypeAliasAttribute, false);
if (attrs != null && attrs.Length > 0 && attrs[0] != null) {
TypeAliasAttribute attr = attrs[0] as TypeAliasAttribute;
foreach (string alias in attr.Aliases)
typesByFullName.Add(alias, type);
}
}
}
typeCache = new TypeCache(types, typesByName, typesByFullName);
}