Example #1
0
        internal static void Execute(ILSpyTreeNode[] nodes, uint[] offsets = null)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var methodNode = (MethodTreeNode)nodes[0];

            var module = ILSpyTreeNode.GetModule(nodes[0]);

            Debug.Assert(module != null);
            if (module == null)
            {
                throw new InvalidOperationException();
            }

            var data = new MethodBodyVM(new MethodBodyOptions(methodNode.MethodDefinition), module, MainWindow.Instance.CurrentLanguage, methodNode.MethodDefinition.DeclaringType, methodNode.MethodDefinition);
            var win  = new MethodBodyDlg();

            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            win.Title       = string.Format("{0} - {1}", win.Title, methodNode.ToString());

            if (data.IsCilBody && offsets != null)
            {
                data.CilBodyVM.Select(offsets);
            }

            if (win.ShowDialog() != true)
            {
                return;
            }

            UndoCommandManager.Instance.Add(new MethodBodySettingsCommand(methodNode, data.CreateMethodBodyOptions()));
        }
Example #2
0
        internal static void Execute(ILSpyTreeNode[] nodes, uint[] offsets = null)
        {
            if (!CanExecute(nodes))
                return;

            var methodNode = (MethodTreeNode)nodes[0];

            var module = ILSpyTreeNode.GetModule(nodes[0]);
            Debug.Assert(module != null);
            if (module == null)
                throw new InvalidOperationException();

            var data = new MethodBodyVM(new MethodBodyOptions(methodNode.MethodDefinition), module, MainWindow.Instance.CurrentLanguage, methodNode.MethodDefinition.DeclaringType, methodNode.MethodDefinition);
            var win = new MethodBodyDlg();
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            win.Title = string.Format("{0} - {1}", win.Title, methodNode.ToString());

            if (data.IsCilBody && offsets != null)
                data.CilBodyVM.Select(offsets);

            if (win.ShowDialog() != true)
                return;

            UndoCommandManager.Instance.Add(new MethodBodySettingsCommand(methodNode, data.CreateMethodBodyOptions()));
        }