Exemplo n.º 1
0
		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 = "Create Nested Type";
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			if (win.ShowDialog() != true)
				return;

			UndoCommandManager.Instance.Add(new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()));
		}
Exemplo n.º 2
0
		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()));
		}
Exemplo n.º 3
0
		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 = "Create Type";
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			if (win.ShowDialog() != true)
				return;

			UndoCommandManager.Instance.Add(new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()));
		}
Exemplo n.º 4
0
        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()));
        }
Exemplo n.º 5
0
        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 = "Create Type";
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            UndoCommandManager.Instance.Add(new CreateTypeDefCommand(module.Types, nodes[0], data.CreateTypeDefOptions()));
        }
Exemplo n.º 6
0
        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 = "Create Nested Type";
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            UndoCommandManager.Instance.Add(new CreateNestedTypeDefCommand(typeNode, data.CreateTypeDefOptions()));
        }