Example #1
0
        static void Execute(Lazy <IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes)
        {
            if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
            {
                return;
            }

            var asmNode = (IDnSpyFileNode)nodes[0];

            if (asmNode is IModuleFileNode)
            {
                asmNode = (IAssemblyFileNode)asmNode.TreeNode.Parent.Data;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM(asmNode.DnSpyFile.ModuleDef);

            win.DataContext = data;
            win.Owner       = appWindow.MainWindow;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var options    = data.CreateNetModuleOptions();
            var newModule  = ModuleUtils.CreateNetModule(options.Name, options.Mvid, options.ClrVersion);
            var newFile    = DnSpyDotNetFile.CreateModule(DnSpyFileInfo.CreateFile(string.Empty), newModule, appWindow.FileTreeView.FileManager.Settings.LoadPDBFiles);
            var newModNode = asmNode.Context.FileTreeView.CreateModule(newFile);
            var cmd        = new AddNewNetModuleToAssemblyCommand(undoCommandManager.Value, (IDnSpyFileNode)nodes[0], newModNode);

            undoCommandManager.Value.Add(cmd);
            appWindow.FileTabManager.FollowReference(cmd.modNode);
        }
Example #2
0
        static void Execute(Lazy <IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes)
        {
            if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
            {
                return;
            }

            var asmNode = (DsDocumentNode)nodes[0];

            if (asmNode is ModuleDocumentNode)
            {
                asmNode = (AssemblyDocumentNode)asmNode.TreeNode.Parent.Data;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM(asmNode.Document.ModuleDef);

            win.DataContext = data;
            win.Owner       = appService.MainWindow;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var options    = data.CreateNetModuleOptions();
            var newModule  = ModuleUtils.CreateNetModule(options.Name, options.Mvid, options.ClrVersion);
            var newFile    = DsDotNetDocument.CreateModule(DsDocumentInfo.CreateDocument(string.Empty), newModule, true);
            var newModNode = asmNode.Context.DocumentTreeView.CreateModule(newFile);
            var cmd        = new AddNewNetModuleToAssemblyCommand(undoCommandService.Value, (DsDocumentNode)nodes[0], newModNode);

            undoCommandService.Value.Add(cmd);
            appService.DocumentTabService.FollowReference(cmd.modNode);
        }
Example #3
0
		static void Execute(ILSpyTreeNode[] nodes) {
			if (!CanExecute(nodes))
				return;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM();
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			if (win.ShowDialog() != true)
				return;

			var cmd = new CreateNetModuleCommand(data.CreateNetModuleOptions());
			UndoCommandManager.Instance.Add(cmd);
			MainWindow.Instance.JumpToReference(cmd.asmNodeCreator.AssemblyTreeNode);
		}
Example #4
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM();

            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            if (win.ShowDialog() != true)
            {
                return;
            }

            UndoCommandManager.Instance.Add(new CreateNetModuleCommand(data.CreateNetModuleOptions()));
        }
Example #5
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM();

            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var cmd = new CreateNetModuleCommand(data.CreateNetModuleOptions());

            UndoCommandManager.Instance.Add(cmd);
            MainWindow.Instance.JumpToReference(cmd.asmNodeCreator.AssemblyTreeNode);
        }
Example #6
0
        static void Execute(Lazy <IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM();

            win.DataContext = data;
            win.Owner       = appService.MainWindow;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var cmd = new CreateNetModuleCommand(undoCommandService, appService.DocumentTreeView, data.CreateNetModuleOptions());

            undoCommandService.Value.Add(cmd);
            appService.DocumentTabService.FollowReference(cmd.fileNodeCreator.DocumentNode);
        }
Example #7
0
        static void Execute(Lazy <IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM();

            win.DataContext = data;
            win.Owner       = appWindow.MainWindow;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var cmd = new CreateNetModuleCommand(undoCommandManager, appWindow.FileTreeView, data.CreateNetModuleOptions());

            undoCommandManager.Value.Add(cmd);
            appWindow.FileTabManager.FollowReference(cmd.fileNodeCreator.DnSpyFileNode);
        }
Example #8
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
                return;

            var asmNode = (AssemblyTreeNode)nodes[0];
            if (asmNode.Parent is AssemblyTreeNode)
                asmNode = (AssemblyTreeNode)asmNode.Parent;

            var win = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM(asmNode.LoadedAssembly.ModuleDefinition);
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            var cmd = new AddNewNetModuleToAssemblyCommand((AssemblyTreeNode)nodes[0], data.CreateNetModuleOptions());
            UndoCommandManager.Instance.Add(cmd);
            MainWindow.Instance.JumpToReference(cmd.modNode);
        }
Example #9
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
            {
                return;
            }

            var asmNode = (AssemblyTreeNode)nodes[0];

            if (asmNode.Parent is AssemblyTreeNode)
            {
                asmNode = (AssemblyTreeNode)asmNode.Parent;
            }

            var win  = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM(asmNode.LoadedAssembly.ModuleDefinition);

            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            if (win.ShowDialog() != true)
            {
                return;
            }

            var cmd = new AddNewNetModuleToAssemblyCommand((AssemblyTreeNode)nodes[0], data.CreateNetModuleOptions());

            UndoCommandManager.Instance.Add(cmd);
            MainWindow.Instance.JumpToReference(cmd.modNode);
        }
Example #10
0
		static void Execute(Lazy<IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) {
			if (!CanExecute(nodes))
				return;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM();
			win.DataContext = data;
			win.Owner = appWindow.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var cmd = new CreateNetModuleCommand(undoCommandManager, appWindow.FileTreeView, data.CreateNetModuleOptions());
			undoCommandManager.Value.Add(cmd);
			appWindow.FileTabManager.FollowReference(cmd.fileNodeCreator.DnSpyFileNode);
		}
Example #11
0
		static void Execute(Lazy<IUndoCommandManager> undoCommandManager, IAppWindow appWindow, IFileTreeNodeData[] nodes) {
			if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
				return;

			var asmNode = (IDnSpyFileNode)nodes[0];
			if (asmNode is IModuleFileNode)
				asmNode = (IAssemblyFileNode)asmNode.TreeNode.Parent.Data;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM(asmNode.DnSpyFile.ModuleDef);
			win.DataContext = data;
			win.Owner = appWindow.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var options = data.CreateNetModuleOptions();
			var newModule = ModuleUtils.CreateNetModule(options.Name, options.Mvid, options.ClrVersion);
			var newFile = DnSpyDotNetFile.CreateModule(DnSpyFileInfo.CreateFile(string.Empty), newModule, appWindow.FileTreeView.FileManager.Settings.LoadPDBFiles);
			var newModNode = asmNode.Context.FileTreeView.CreateModule(newFile);
			var cmd = new AddNewNetModuleToAssemblyCommand(undoCommandManager.Value, (IDnSpyFileNode)nodes[0], newModNode);
			undoCommandManager.Value.Add(cmd);
			appWindow.FileTabManager.FollowReference(cmd.modNode);
		}
Example #12
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
                return;

            var win = new NetModuleOptionsDlg();
            var data = new NetModuleOptionsVM();
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            UndoCommandManager.Instance.Add(new CreateNetModuleCommand(data.CreateNetModuleOptions()));
        }
Example #13
0
		static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) {
			if (!CanExecute(nodes))
				return;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM();
			win.DataContext = data;
			win.Owner = appService.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var cmd = new CreateNetModuleCommand(undoCommandService, appService.DocumentTreeView, data.CreateNetModuleOptions());
			undoCommandService.Value.Add(cmd);
			appService.DocumentTabService.FollowReference(cmd.fileNodeCreator.DocumentNode);
		}
Example #14
0
		static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, DocumentTreeNodeData[] nodes) {
			if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
				return;

			var asmNode = (DsDocumentNode)nodes[0];
			if (asmNode is ModuleDocumentNode)
				asmNode = (AssemblyDocumentNode)asmNode.TreeNode.Parent.Data;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM(asmNode.Document.ModuleDef);
			win.DataContext = data;
			win.Owner = appService.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var options = data.CreateNetModuleOptions();
			var newModule = ModuleUtils.CreateNetModule(options.Name, options.Mvid, options.ClrVersion);
			var newFile = DsDotNetDocument.CreateModule(DsDocumentInfo.CreateDocument(string.Empty), newModule, true);
			var newModNode = asmNode.Context.DocumentTreeView.CreateModule(newFile);
			var cmd = new AddNewNetModuleToAssemblyCommand(undoCommandService.Value, (DsDocumentNode)nodes[0], newModNode);
			undoCommandService.Value.Add(cmd);
			appService.DocumentTabService.FollowReference(cmd.modNode);
		}