static void Execute(Lazy <IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) { if (!CanExecute(nodes)) { return; } var typeNode = (ITypeNode)nodes[0]; var module = nodes[0].GetModule(); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var data = new TypeOptionsVM(new TypeDefOptions(typeNode.TypeDef), module, appWindow.LanguageManager, typeNode.TypeDef); var win = new TypeOptionsDlg(); win.DataContext = data; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) { return; } undoCommandManager.Value.Add(new TypeDefSettingsCommand(module, typeNode, data.CreateTypeDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) { return; } var typeNode = (TypeTreeNode)nodes[0]; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var data = new TypeOptionsVM(new TypeDefOptions(typeNode.TypeDef), module, MainWindow.Instance.CurrentLanguage, typeNode.TypeDef); var win = new TypeOptionsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } UndoCommandManager.Instance.Add(new TypeDefSettingsCommand(module, typeNode, data.CreateTypeDefOptions())); }
static void Execute(Lazy <IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) { if (!CanExecute(nodes)) { return; } var nsNode = nodes[0].GetAncestorOrSelf <INamespaceNode>(); string ns = nsNode?.Name ?? string.Empty; var module = nodes[0].GetModule(); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var options = TypeDefOptions.Create(ns, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, false); var data = new TypeOptionsVM(options, module, appWindow.LanguageManager, null); var win = new TypeOptionsDlg(); win.Title = dnSpy_AsmEditor_Resources.CreateTypeCommand2; win.DataContext = data; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) { return; } var cmd = new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()); undoCommandManager.Value.Add(cmd); appWindow.FileTabManager.FollowReference(cmd.typeNode); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) { return; } var nsNode = ILSpyTreeNode.GetNode <NamespaceTreeNode>(nodes[0]); string ns = nsNode == null ? string.Empty : nsNode.Name; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var options = TypeDefOptions.Create(ns, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, false); var data = new TypeOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, null); var win = new TypeOptionsDlg(); win.Title = CMD_NAME; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } var cmd = new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()); UndoCommandManager.Instance.Add(cmd); MainWindow.Instance.JumpToReference(cmd.typeNode); }
static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var ownerNode = nodes[0]; if (!(ownerNode is TypeNode)) ownerNode = (DocumentTreeNodeData)ownerNode.TreeNode.Parent.Data; var typeNode = ownerNode as TypeNode; Debug.Assert(typeNode != null); if (typeNode == null) throw new InvalidOperationException(); var module = typeNode.GetModule(); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var options = TypeDefOptions.Create(UTF8String.Empty, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, true); var data = new TypeOptionsVM(options, module, appService.DecompilerService, null); var win = new TypeOptionsDlg(); win.Title = dnSpy_AsmEditor_Resources.CreateNestedTypeCommand2; win.DataContext = data; win.Owner = appService.MainWindow; if (win.ShowDialog() != true) return; var cmd = new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()); undoCommandService.Value.Add(cmd); appService.DocumentTabService.FollowReference(cmd.nestedType); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) { return; } var ownerNode = nodes[0]; if (!(ownerNode is TypeTreeNode)) { ownerNode = (ILSpyTreeNode)ownerNode.Parent; } var typeNode = ownerNode as TypeTreeNode; Debug.Assert(typeNode != null); if (typeNode == null) { throw new InvalidOperationException(); } var module = ILSpyTreeNode.GetModule(typeNode); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var options = TypeDefOptions.Create(UTF8String.Empty, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, true); var data = new TypeOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, null); var win = new TypeOptionsDlg(); win.Title = CMD_NAME; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } var cmd = new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()); UndoCommandManager.Instance.Add(cmd); MainWindow.Instance.JumpToReference(cmd.nestedType); }
static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var typeNode = (TypeNode)nodes[0]; var module = nodes[0].GetModule(); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var data = new TypeOptionsVM(new TypeDefOptions(typeNode.TypeDef), module, appService.DecompilerService, typeNode.TypeDef); var win = new TypeOptionsDlg(); win.DataContext = data; win.Owner = appService.MainWindow; if (win.ShowDialog() != true) return; undoCommandService.Value.Add(new TypeDefSettingsCommand(module, typeNode, data.CreateTypeDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) return; var typeNode = (TypeTreeNode)nodes[0]; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var data = new TypeOptionsVM(new TypeDefOptions(typeNode.TypeDefinition), module, MainWindow.Instance.CurrentLanguage, typeNode.TypeDefinition); var win = new TypeOptionsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; UndoCommandManager.Instance.Add(new TypeDefSettingsCommand(module, typeNode, data.CreateTypeDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) return; var ownerNode = nodes[0]; if (!(ownerNode is TypeTreeNode)) ownerNode = (ILSpyTreeNode)ownerNode.Parent; var typeNode = ownerNode as TypeTreeNode; Debug.Assert(typeNode != null); if (typeNode == null) throw new InvalidOperationException(); var module = ILSpyTreeNode.GetModule(typeNode); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var options = TypeDefOptions.Create(UTF8String.Empty, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, true); var data = new TypeOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, null); var win = new TypeOptionsDlg(); win.Title = CMD_NAME; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; var cmd = new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()); UndoCommandManager.Instance.Add(cmd); MainWindow.Instance.JumpToReference(cmd.nestedType); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) return; var nsNode = ILSpyTreeNode.GetNode<NamespaceTreeNode>(nodes[0]); string ns = nsNode == null ? string.Empty : nsNode.Name; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var options = TypeDefOptions.Create(ns, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, false); var data = new TypeOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, null); var win = new TypeOptionsDlg(); win.Title = CMD_NAME; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; var cmd = new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()); UndoCommandManager.Instance.Add(cmd); MainWindow.Instance.JumpToReference(cmd.typeNode); }
static void Execute(Lazy<IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var typeNode = (ITypeNode)nodes[0]; var module = nodes[0].GetModule(); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var data = new TypeOptionsVM(new TypeDefOptions(typeNode.TypeDef), module, appWindow.LanguageManager, typeNode.TypeDef); var win = new TypeOptionsDlg(); win.DataContext = data; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) return; undoCommandManager.Value.Add(new TypeDefSettingsCommand(module, typeNode, data.CreateTypeDefOptions())); }
static void Execute(Lazy<IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var ownerNode = nodes[0]; if (!(ownerNode is ITypeNode)) ownerNode = (IFileTreeNodeData)ownerNode.TreeNode.Parent.Data; var typeNode = ownerNode as ITypeNode; Debug.Assert(typeNode != null); if (typeNode == null) throw new InvalidOperationException(); var module = typeNode.GetModule(); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var options = TypeDefOptions.Create(UTF8String.Empty, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, true); var data = new TypeOptionsVM(options, module, appWindow.LanguageManager, null); var win = new TypeOptionsDlg(); win.Title = dnSpy_AsmEditor_Resources.CreateNestedTypeCommand2; win.DataContext = data; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) return; var cmd = new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()); undoCommandManager.Value.Add(cmd); appWindow.FileTabManager.FollowReference(cmd.nestedType); }
static void Execute(Lazy<IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) { if (!CanExecute(nodes)) return; var nsNode = nodes[0].GetAncestorOrSelf<INamespaceNode>(); string ns = nsNode == null ? string.Empty : nsNode.Name; var module = nodes[0].GetModule(); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var options = TypeDefOptions.Create(ns, TypeConstants.DEFAULT_TYPE_NAME, module.CorLibTypes.Object.TypeDefOrRef, false); var data = new TypeOptionsVM(options, module, appWindow.LanguageManager, null); var win = new TypeOptionsDlg(); win.Title = dnSpy_AsmEditor_Resources.CreateTypeCommand2; win.DataContext = data; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) return; var cmd = new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()); undoCommandManager.Value.Add(cmd); appWindow.FileTabManager.FollowReference(cmd.typeNode); }