コード例 #1
0
ファイル: ResourceCommands.cs プロジェクト: damnya/dnSpy
        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()));
        }
コード例 #2
-1
ファイル: ResourceCommands.cs プロジェクト: damnya/dnSpy
        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.Embedded,
                Name = "my.resources",
                Attributes = ManifestResourceAttributes.Public,
            };
            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 node = new ResourceElementSetTreeNode(module, data.Name, data.Attributes);
            UndoCommandManager.Instance.Add(new CreateMultiFileResourceCommand(rsrcListNode, node));
        }
コード例 #3
-1
ファイル: ResourceCommands.cs プロジェクト: damnya/dnSpy
        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));
        }
コード例 #4
-1
ファイル: ResourceCommands.cs プロジェクト: damnya/dnSpy
        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.AssemblyLinked,
                Name = "asmlinked",
                Attributes = ManifestResourceAttributes.Public,
                Assembly = module.CorLibTypes.AssemblyRef,
            };
            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 node = ResourceFactory.Create(module, new AssemblyLinkedResource(data.Name, data.Assembly, data.Attributes));
            UndoCommandManager.Instance.Add(new CreateAssemblyLinkedResourceCommand(rsrcListNode, node));
        }