void PickNewDbgShimFilename() { if (pickFilename == null) { throw new InvalidOperationException(); } var newFilename = pickFilename.GetFilename(DbgShimFilename, "exe", PickFilenameConstants.ExecutableFilter); if (newFilename == null) { return; } this.DbgShimFilename = newFilename; }
void PickNewDbgShimFilename() { if (pickFilename == null) { throw new InvalidOperationException(); } var filter = string.Format("dbgshim.dll|dbgshim.dll|{0} (*.*)|*.*", dnSpy_Debugger_Resources.AllFiles); var newFilename = pickFilename.GetFilename(DbgShimFilename, "exe", filter); if (newFilename == null) { return; } DbgShimFilename = newFilename; }
static void Execute(IPickFilename pickFilename, Lazy <IAddUpdatedNodesHelperProvider> addUpdatedNodesHelperProvider, Lazy <IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) { if (!CanExecute(nodes)) { return; } var modNode = GetModuleNode(nodes[0]); Debug.Assert(modNode != null); if (modNode == null) { return; } var module = modNode.Document.ModuleDef; Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var filename = pickFilename.GetFilename(null, "dll", PickFilenameConstants.DotNetAssemblyOrModuleFilter); var result = GetModuleBytes(filename); if (result == null) { return; } // This is a basic assembly merger, we don't support merging dependencies. It would require // fixing all refs to the dep and redirect them to the new defs that now exist in 'module'. var asm = module.Assembly; if (asm != null && result.Value.Assembly != null) { if (IsNonSupportedAssembly(module, asm, result.Value.Assembly)) { Contracts.App.MsgBox.Instance.Show($"Can't merge with {result.Value.Assembly} because it's a dependency"); return; } } var importer = new ModuleImporter(module); try { importer.Import(result.Value.RawBytes, result.Value.DebugFile, ModuleImporterOptions.None); } catch (Exception ex) { Contracts.App.MsgBox.Instance.Show(ex); return; } undoCommandService.Value.Add(new MergeWithAssemblyCommand(addUpdatedNodesHelperProvider, modNode, importer)); }
void PickNewCoreCLRDbgShimFilename() { const string filter = "dbgshim.dll|dbgshim.dll|All files (*.*)|*.*";; var newFilename = pickFilename.GetFilename(Settings.CoreCLRDbgShimFilename, "exe", filter); if (newFilename == null) { return; } Settings.CoreCLRDbgShimFilename = newFilename; }
void PickNewCoreCLRDbgShimFilename() { var filter = string.Format("dbgshim.dll|dbgshim.dll|{0} (*.*)|*.*", dnSpy_Debugger_Resources.AllFiles); var newFilename = pickFilename.GetFilename(Settings.CoreCLRDbgShimFilename, "exe", filter); if (newFilename == null) { return; } Settings.CoreCLRDbgShimFilename = newFilename; }
public override void ImportBreakpoints() { var filename = pickFilename.GetFilename(null, "xml", PickFilenameConstants.XmlFilenameFilter); if (!File.Exists(filename)) { return; } var settingsService = settingsServiceFactory.Value.Create(); try { settingsService.Open(filename); } catch (Exception ex) { messageBoxService.Show(ex); return; } dbgCodeBreakpointsService.Value.Add(new BreakpointsSerializer(settingsService, dbgCodeLocationSerializerService.Value).Load()); }
public override void ImportBookmarks() { var filename = pickFilename.GetFilename(null, "xml", PickFilenameConstants.XmlFilenameFilter); if (!File.Exists(filename)) { return; } Debug.Assert(!(filename is null)); var settingsService = settingsServiceFactory.Value.Create(); try { settingsService.Open(filename); } catch (Exception ex) { messageBoxService.Show(ex); return; } var bookmarks = new BookmarksSerializer(settingsService, bookmarkLocationSerializerService.Value).Load(); bookmarksService.Value.Add(bookmarks); }
public override void ImportBreakpoints() { var filename = pickFilename.GetFilename(null, "xml", PickFilenameConstants.XmlFilenameFilter); if (!File.Exists(filename)) { return; } Debug2.Assert(filename is not null); var settingsService = settingsServiceFactory.Value.Create(); try { settingsService.Open(filename); } catch (Exception ex) { messageBoxService.Show(ex); return; } var breakpoints = new BreakpointsSerializer(settingsService).Load(); dbgModuleBreakpointsService.Value.Add(breakpoints); }
static void Execute(IPickFilename pickFilename, Lazy<IAddUpdatedNodesHelperProvider> addUpdatedNodesHelperProvider, Lazy<IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var asmNode = nodes[0] as AssemblyDocumentNode; ModuleDocumentNode modNode; if (asmNode != null) { asmNode.TreeNode.EnsureChildrenLoaded(); modNode = asmNode.TreeNode.DataChildren.FirstOrDefault() as ModuleDocumentNode; } else modNode = nodes[0].GetModuleNode(); Debug.Assert(modNode != null); if (modNode == null) return; var module = modNode.Document.ModuleDef; Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var filename = pickFilename.GetFilename(null, "dll", PickFilenameConstants.DotNetAssemblyOrModuleFilter); var result = GetModuleBytes(filename); if (result == null) return; // This is a basic assembly merger, we don't support merging dependencies. It would require // fixing all refs to the dep and redirect them to the new defs that now exist in 'module'. var asm = module.Assembly; if (asm != null && result.Value.Assembly != null) { if (IsNonSupportedAssembly(module, asm, result.Value.Assembly)) { Contracts.App.MsgBox.Instance.Show($"Can't merge with {result.Value.Assembly} because it's a dependency"); return; } } var importer = new ModuleImporter(module, EditCodeVM.makeEverythingPublic); try { importer.Import(result.Value.RawBytes, result.Value.DebugFile, ModuleImporterOptions.None); } catch (Exception ex) { Contracts.App.MsgBox.Instance.Show(ex); return; } undoCommandService.Value.Add(new MergeWithAssemblyCommand(addUpdatedNodesHelperProvider, modNode, importer)); }