Exemple #1
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
                return;

            var rsrcNode = (ResourceTreeNode)nodes[0];

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

            var data = new ResourceVM(new ResourceOptions(rsrcNode.Resource), module);
            var win = new ResourceDlg();
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            UndoCommandManager.Instance.Add(new ResourceSettingsCommand(rsrcNode, data.CreateResourceOptions()));
        }
Exemple #2
-1
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
                return;

            var rsrcListNode = Utils.GetResourceListTreeNode(nodes);

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

            var options = new ResourceOptions {
                ResourceType = ResourceType.Linked,
                Name = "filelinked",
                Attributes = ManifestResourceAttributes.Public,
                File = new FileDefUser("somefile", dnlib.DotNet.FileAttributes.ContainsNoMetaData, new byte[0]),
            };
            var data = new ResourceVM(options, module);
            var win = new ResourceDlg();
            win.Title = CMD_NAME;
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            var opts = data.CreateResourceOptions();
            var node = ResourceFactory.Create(module, new LinkedResource(opts.Name, opts.File, opts.Attributes));
            UndoCommandManager.Instance.Add(new CreateFileLinkedResourceCommand(rsrcListNode, node));
        }