You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.Composition; using System.Linq;
using ICSharpCode.ILSpy; using ICSharpCode.ILSpy.TreeNodes;
namespace TestPlugin { [ExportContextMenuEntryAttribute(Header = "_Save Assembly")] [Shared] public class SaveAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) { return context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n is AssemblyTreeNode); }
public bool IsEnabled(TextViewContext context) { return context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length == 1; }
public void Execute(TextViewContext context) { if (context.SelectedTreeNodes == null) return; AssemblyTreeNode node = (AssemblyTreeNode)context.SelectedTreeNodes[0]; var asm = node.LoadedAssembly.GetMetadataFileOrNull(); if (asm != null) { /*SaveFileDialog dlg = new SaveFileDialog(); dlg.FileName = node.LoadedAssembly.FileName; dlg.Filter = "Assembly|*.dll;*.exe"; if (dlg.ShowDialog(MainWindow.Instance) == true) { asm.MainModule.Write(dlg.FileName); }*/ } } } }
|