public virtual void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options) { WriteCommentLine(output, assembly.FileName); var asm = assembly.GetAssemblyDefinitionOrNull(); if (asm != null) { var name = asm.Name; if (name.IsWindowsRuntime) { WriteCommentLine(output, name.Name + " [WinRT]"); } else { WriteCommentLine(output, name.FullName); } } else { WriteCommentLine(output, assembly.GetModuleDefinitionAsync().Result.Name); } }
public ILSpyWholeProjectDecompiler(LoadedAssembly assembly, DecompilationOptions options) { this.assembly = assembly; this.options = options; base.Settings = options.DecompilerSettings; }
public MyUniversalResolver(LoadedAssembly assembly) : base(assembly.FileName, false) { }
LoadedAssembly LookupReferencedAssemblyInternal(AssemblyNameReference fullName, bool isWinRT) { string GetName(AssemblyNameReference name) => isWinRT ? name.Name : name.FullName; string file; LoadedAssembly asm; lock (loadingAssemblies) { foreach (LoadedAssembly loaded in assemblyList.GetAssemblies()) { var asmDef = loaded.GetAssemblyDefinitionOrNull(); if (asmDef != null && GetName(fullName).Equals(GetName(asmDef.Name), StringComparison.OrdinalIgnoreCase)) { LoadedAssemblyReferencesInfo.AddMessageOnce(fullName.ToString(), MessageKind.Info, "Success - Found in Assembly List"); return(loaded); } } if (isWinRT) { file = Path.Combine(Environment.SystemDirectory, "WinMetadata", fullName.Name + ".winmd"); } else { var resolver = new MyUniversalResolver(this) { TargetFramework = GetTargetFrameworkIdAsync().Result }; file = resolver.FindAssemblyFile(fullName); } foreach (LoadedAssembly loaded in assemblyList.GetAssemblies()) { if (loaded.FileName.Equals(file, StringComparison.OrdinalIgnoreCase)) { return(loaded); } } if (file != null && loadingAssemblies.TryGetValue(file, out asm)) { return(asm); } if (assemblyLoadDisableCount > 0) { return(null); } if (file != null) { LoadedAssemblyReferencesInfo.AddMessage(fullName.ToString(), MessageKind.Info, "Success - Loading from: " + file); asm = new LoadedAssembly(assemblyList, file) { IsAutoLoaded = true }; } else { LoadedAssemblyReferencesInfo.AddMessageOnce(fullName.ToString(), MessageKind.Error, "Could not find reference: " + fullName); return(null); } loadingAssemblies.Add(file, asm); } Dispatcher.UIThread.InvokeAsync((Action) delegate() { lock (assemblyList.assemblies) { assemblyList.assemblies.Add(asm); } lock (loadingAssemblies) { loadingAssemblies.Remove(file); } }); return(asm); }
public MyAssemblyResolver(LoadedAssembly parent) { this.parent = parent; }