protected ImporterInfoBase(string typeName, ContentImporterAttribute attribute)
 {
     TypeName = typeName;
     CacheImportedData = attribute.CacheImportedData;
     DefaultProcessor = attribute.DefaultProcessor;
     DisplayName = attribute.DisplayName;
     fileExtensions.AddRange(attribute.FileExtensions);
 }
 public AssemblyReferenceImporterInfo(string typeName, ContentImporterAttribute attribute, IAssemblyReference assemblyReference)
     : base(typeName, attribute)
 {
     AssemblyReference = assemblyReference;
 }
        private void ResolveAssemblies()
        {
            _importers = new List<ImporterInfo>();
            _processors = new List<ProcessorInfo>();
            _writers = new List<Type>();

            // Finally load the pipeline assemblies.
            foreach (var assemblyPath in Assemblies)
            {
                Type[] exportedTypes;
                try
                {
                    Assembly a;
                    if (string.IsNullOrEmpty(assemblyPath))
                    {
                        // Get the types from this assembly, which includes all of the
                        // built-in importers, processors and type writers
                        a = Assembly.GetExecutingAssembly();
                        // The built-in types may not be public, so get all types
                        exportedTypes = a.GetTypes();
                    }
                    else
                    {
                        a = Assembly.LoadFrom(assemblyPath);
                        // We only look at public types for external importers, processors
                        // and type writers.
                        exportedTypes = a.GetExportedTypes();
                    }
                }
                catch (Exception)
                {
                    // The assembly failed to load... nothing
                    // we can do but ignore it.
                    continue;
                }

                foreach (var t in exportedTypes)
                {
                    if (!t.IsPublic || t.IsAbstract) 
                        continue;

                    if (t.GetInterface(@"IContentImporter") != null)
                    {
                        var attributes = t.GetCustomAttributes(typeof (ContentImporterAttribute), false);
                        if (attributes.Length != 0)
                        {
                            var importerAttribute = attributes[0] as ContentImporterAttribute;
                            _importers.Add(new ImporterInfo { attribue = importerAttribute, type = t });
                        }
                        else
                        {
                            // If no attribute specify default one
                            var importerAttribute = new ContentImporterAttribute(".*");
                            importerAttribute.DefaultProcessor = "";
                            importerAttribute.DisplayName = t.Name;
                            _importers.Add(new ImporterInfo { attribue = importerAttribute, type = t });
                        }
                    }
                    else if (t.GetInterface(@"IContentProcessor") != null)
                    {
                        var attributes = t.GetCustomAttributes(typeof (ContentProcessorAttribute), false);
                        if (attributes.Length != 0)
                        {
                            var processorAttribute = attributes[0] as ContentProcessorAttribute;
                            _processors.Add(new ProcessorInfo {attribue = processorAttribute, type = t});
                        }
                    }
                    else if (t.GetInterface(@"ContentTypeWriter") != null)
                    {
						// TODO: This doesn't work... how do i find these?
                        _writers.Add(t);
                    }
                }
            }
        }
 public AssemblyImporterInfo(string typeName, ContentImporterAttribute attribute, Assembly assembly)
     : base(typeName, attribute)
 {
     Assembly = assembly;
 }