|
|
|
@ -35,7 +35,7 @@ namespace ICSharpCode.ILSpy
@@ -35,7 +35,7 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
readonly string fileName; |
|
|
|
|
readonly string shortName; |
|
|
|
|
|
|
|
|
|
public LoadedAssembly(AssemblyList assemblyList, string fileName) |
|
|
|
|
public LoadedAssembly(AssemblyList assemblyList, string fileName, Stream stream = null) |
|
|
|
|
{ |
|
|
|
|
if (assemblyList == null) |
|
|
|
|
throw new ArgumentNullException("assemblyList"); |
|
|
|
@ -44,7 +44,7 @@ namespace ICSharpCode.ILSpy
@@ -44,7 +44,7 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
this.assemblyList = assemblyList; |
|
|
|
|
this.fileName = fileName; |
|
|
|
|
|
|
|
|
|
this.assemblyTask = Task.Factory.StartNew<ModuleDefinition>(LoadAssembly); // requires that this.fileName is set
|
|
|
|
|
this.assemblyTask = Task.Factory.StartNew<ModuleDefinition>(LoadAssembly, stream); // requires that this.fileName is set
|
|
|
|
|
this.shortName = Path.GetFileNameWithoutExtension(fileName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -93,12 +93,26 @@ namespace ICSharpCode.ILSpy
@@ -93,12 +93,26 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
get { return assemblyTask.IsFaulted; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ModuleDefinition LoadAssembly() |
|
|
|
|
ModuleDefinition LoadAssembly(object state) |
|
|
|
|
{ |
|
|
|
|
var stream = state as Stream; |
|
|
|
|
ModuleDefinition module; |
|
|
|
|
|
|
|
|
|
// runs on background thread
|
|
|
|
|
ReaderParameters p = new ReaderParameters(); |
|
|
|
|
p.AssemblyResolver = new MyAssemblyResolver(this); |
|
|
|
|
ModuleDefinition module = ModuleDefinition.ReadModule(fileName, p); |
|
|
|
|
|
|
|
|
|
if (stream != null) |
|
|
|
|
{ |
|
|
|
|
// Read the module from a precrafted stream
|
|
|
|
|
module = ModuleDefinition.ReadModule(stream, p); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// Read the module from disk (by default)
|
|
|
|
|
module = ModuleDefinition.ReadModule(fileName, p); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DecompilerSettingsPanel.CurrentDecompilerSettings.UseDebugSymbols) { |
|
|
|
|
try { |
|
|
|
|
LoadSymbols(module); |
|
|
|
|