Pull up ExtensionInterface.
This commit is contained in:
@@ -25,13 +25,26 @@ namespace Cryville.Crtr.Browsing {
|
||||
static LegacyResourceManager() {
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
|
||||
foreach (var type in asm.GetTypes()) {
|
||||
if (type.IsSubclassOf(typeof(ResourceConverter))) {
|
||||
var converter = (ResourceConverter)Activator.CreateInstance(type);
|
||||
foreach (var f in converter.GetSupportedFormats()) {
|
||||
if (!type.IsSubclassOf(typeof(ExtensionInterface))) continue;
|
||||
var ext = (ExtensionInterface)Activator.CreateInstance(type);
|
||||
try {
|
||||
var cs = ext.GetResourceConverters();
|
||||
if (cs != null) {
|
||||
foreach (var c in cs) {
|
||||
var fs = c.GetSupportedFormats();
|
||||
if (fs == null) continue;
|
||||
foreach (var f in fs) {
|
||||
if (f == null) continue;
|
||||
if (!converters.ContainsKey(f))
|
||||
converters.Add(f, new List<ResourceConverter> { converter });
|
||||
else converters[f].Add(converter);
|
||||
converters.Add(f, new List<ResourceConverter> { c });
|
||||
else converters[f].Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.Log("main", 1, "Resource", "Loaded extension {0}", ReflectionHelper.GetNamespaceQualifiedName(type));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Log("main", 4, "Resource", "Failed to initialize extension {0}: {1}", ReflectionHelper.GetNamespaceQualifiedName(type), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user