Loader: Unwrap FileFormatReader.Load exceptions
This commit is contained in:
@@ -60,11 +60,16 @@ namespace Il2CppInspector
|
|||||||
.Where(x => x.ImplementedInterfaces.Contains(typeof(IFileFormatReader)) && !x.IsGenericTypeDefinition);
|
.Where(x => x.ImplementedInterfaces.Contains(typeof(IFileFormatReader)) && !x.IsGenericTypeDefinition);
|
||||||
|
|
||||||
foreach (var type in types) {
|
foreach (var type in types) {
|
||||||
|
try {
|
||||||
if (type.GetMethod("Load", BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Public,
|
if (type.GetMethod("Load", BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Public,
|
||||||
null, new [] {typeof(Stream), typeof(EventHandler<string>)}, null)
|
null, new[] {typeof(Stream), typeof(EventHandler<string>)}, null)
|
||||||
.Invoke(null, new object[] { stream, statusCallback }) is IFileFormatReader loaded)
|
.Invoke(null, new object[] {stream, statusCallback}) is IFileFormatReader loaded)
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
catch (TargetInvocationException ex) {
|
||||||
|
throw ex.InnerException;
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user