only check exported types so that we don't crash on internal types

This commit is contained in:
Ellpeck 2019-12-01 18:53:21 +01:00
parent 33f5c14583
commit e8e69dc1cc
2 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,7 @@
<package> <package>
<metadata> <metadata>
<id>Contentless</id> <id>Contentless</id>
<version>2.0.3</version> <version>2.0.4</version>
<authors>Ellpeck</authors> <authors>Ellpeck</authors>
<description>A tool for MonoGame that automatically handles adding assets to the Content Pipeline project</description> <description>A tool for MonoGame that automatically handles adding assets to the Content Pipeline project</description>
<tags>monogame mono xna content pipeline mgcb builder tool library</tags> <tags>monogame mono xna content pipeline mgcb builder tool library</tags>

View file

@ -142,7 +142,7 @@ namespace Contentless {
private static IEnumerable<ImporterInfo> GetContentImporters() { private static IEnumerable<ImporterInfo> GetContentImporters() {
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
foreach (var type in assembly.GetTypes()) { foreach (var type in assembly.GetExportedTypes()) {
var importer = (ContentImporterAttribute) type.GetCustomAttribute(typeof(ContentImporterAttribute), true); var importer = (ContentImporterAttribute) type.GetCustomAttribute(typeof(ContentImporterAttribute), true);
if (importer != null) if (importer != null)
yield return new ImporterInfo(importer, type); yield return new ImporterInfo(importer, type);
@ -152,7 +152,7 @@ namespace Contentless {
private static IEnumerable<string> GetContentProcessors() { private static IEnumerable<string> GetContentProcessors() {
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
foreach (var type in assembly.GetTypes()) { foreach (var type in assembly.GetExportedTypes()) {
var processor = type.GetCustomAttribute(typeof(ContentProcessorAttribute), true); var processor = type.GetCustomAttribute(typeof(ContentProcessorAttribute), true);
if (processor != null) if (processor != null)
yield return type.Name; yield return type.Name;