/// <summary> /// Creates a <see cref="NotifyFileTreeViewCollection.Add"/> instance /// </summary> /// <param name="file">Added file</param> /// <returns></returns> public static NotifyFileTreeViewCollectionChangedEventArgs CreateAdd(IDnSpyFileNode file) { Debug.Assert(file != null); var e = new NotifyFileTreeViewCollectionChangedEventArgs(); e.Type = NotifyFileTreeViewCollection.Add; e.Nodes = new IDnSpyFileNode[] { file }; return e; }
/// <summary> /// Creates a <see cref="NotifyFileTreeViewCollection.Remove"/> instance /// </summary> /// <param name="files">Removed files</param> /// <returns></returns> public static NotifyFileTreeViewCollectionChangedEventArgs CreateRemove(IDnSpyFileNode[] files) { Debug.Assert(files != null); var e = new NotifyFileTreeViewCollectionChangedEventArgs(); e.Type = NotifyFileTreeViewCollection.Remove; e.Nodes = files; return e; }
/// <summary> /// Creates a <see cref="NotifyFileTreeViewCollection.Clear"/> instance /// </summary> /// <param name="clearedFiles">All cleared files</param> /// <returns></returns> public static NotifyFileTreeViewCollectionChangedEventArgs CreateClear(IDnSpyFileNode[] clearedFiles) { Debug.Assert(clearedFiles != null); var e = new NotifyFileTreeViewCollectionChangedEventArgs(); e.Type = NotifyFileTreeViewCollection.Clear; e.Nodes = clearedFiles; return e; }
/// <summary> /// Creates a <see cref="NotifyFileTreeViewCollection.Add"/> instance /// </summary> /// <param name="file">Added file</param> /// <returns></returns> public static NotifyFileTreeViewCollectionChangedEventArgs CreateAdd(IDnSpyFileNode file) { Debug.Assert(file != null); var e = new NotifyFileTreeViewCollectionChangedEventArgs(); e.Type = NotifyFileTreeViewCollection.Add; e.Nodes = new IDnSpyFileNode[] { file }; return(e); }
public IDnSpyFileNode Create(IFileTreeView fileTreeView, IDnSpyFileNode owner, IDnSpyFile file) { var myFile = file as MyDnSpyFile; if (myFile != null) { return(new MyDnSpyFileNode(myFile)); } return(null); }
void OnNodeRemoved(IDnSpyFileNode node) { var hash = GetSelfAndDnSpyFileNodeChildren(node); foreach (TabContentImpl tab in VisibleFirstTabs) { tab.OnNodesRemoved(hash, () => this.CreateTabContent(new IFileTreeNodeData[0])); } decompilationCache.Clear(new HashSet <IDnSpyFile>(hash.Select(a => a.DnSpyFile))); }
public void AddNode(IDnSpyFileNode fileNode, int index) { if (fileNode == null) { throw new ArgumentNullException(nameof(fileNode)); } Debug.Assert(!TreeView.Root.DataChildren.Contains(fileNode)); Debug.Assert(fileNode.TreeNode.Parent == null); FileManager.ForceAdd(fileNode.DnSpyFile, false, new AddFileInfo(fileNode, index)); Debug.Assert(TreeView.Root.DataChildren.Contains(fileNode)); }
public IDnSpyFileNode CreateNode(IDnSpyFileNode owner, IDnSpyFile file) { foreach (var provider in dnSpyFileNodeProviders) { var result = provider.Value.Create(this, owner, file); if (result != null) { return(result); } } return(new UnknownFileNode(file)); }
public static bool HasPENode(IDnSpyFileNode node) { if (node == null) return false; var peImage = node.DnSpyFile.PEImage; // Only show the PE node if it was loaded from a file. The hex document is always loaded // from a file, so if the PEImage wasn't loaded from the same file, conversion to/from // RVA/FileOffset won't work and the wrong data will be displayed, eg. in the .NET // storage stream nodes. bool loadedFromFile = node.DnSpyFile.Key is FilenameKey; return loadedFromFile && peImage != null; }
public IDnSpyFileNode Create(IFileTreeView fileTreeView, IDnSpyFileNode owner, IDnSpyFile file) { var dnFile = file as IDnSpyDotNetFile; if (dnFile != null) { Debug.Assert(file.ModuleDef != null); if (file.AssemblyDef == null || owner != null) return new ModuleFileNode(dnFile); return new AssemblyFileNode(dnFile); } Debug.Assert(file.AssemblyDef == null && file.ModuleDef == null); if (file.PEImage != null) return new PEFileNode(file); return null; }
static HashSet <IDnSpyFileNode> GetSelfAndDnSpyFileNodeChildren(IDnSpyFileNode node, HashSet <IDnSpyFileNode> hash = null) { if (hash == null) { hash = new HashSet <IDnSpyFileNode>(); } hash.Add(node); foreach (var c in node.TreeNode.DataChildren) { var fileNode = c as IDnSpyFileNode; if (fileNode != null) { GetSelfAndDnSpyFileNodeChildren(fileNode, hash); } } return(hash); }
public static bool HasPENode(IDnSpyFileNode node) { if (node == null) { return(false); } var peImage = node.DnSpyFile.PEImage; // Only show the PE node if it was loaded from a file. The hex document is always loaded // from a file, so if the PEImage wasn't loaded from the same file, conversion to/from // RVA/FileOffset won't work and the wrong data will be displayed, eg. in the .NET // storage stream nodes. bool loadedFromFile = node.DnSpyFile.Key is FilenameKey; return(loadedFromFile && peImage != null); }
public IDnSpyFileNode Create(IFileTreeView fileTreeView, IDnSpyFileNode owner, IDnSpyFile file) { var dnFile = file as IDnSpyDotNetFile; if (dnFile != null) { Debug.Assert(file.ModuleDef != null); if (file.AssemblyDef == null || owner != null) { return(new ModuleFileNode(dnFile)); } return(new AssemblyFileNode(dnFile)); } Debug.Assert(file.AssemblyDef == null && file.ModuleDef == null); if (file.PEImage != null) { return(new PEFileNode(file)); } return(null); }
public AddFileInfo(IDnSpyFileNode fileNode, int index) { this.DnSpyFileNode = fileNode; this.Index = index; }
public UndoRedoInfo(IDnSpyFileNode node, bool isInUndo, bool isInRedo) { this.IsInUndo = isInUndo; this.IsInRedo = isInRedo; this.Node = node; }
public RootDnSpyFileNodeCreator(IFileTreeView fileTreeView, IDnSpyFileNode asmNode) : this(fileTreeView, asmNode, true) { }
RootDnSpyFileNodeCreator(IFileTreeView fileTreeView, IDnSpyFileNode fileNode, bool restoreIndex) { this.fileTreeView = fileTreeView; this.fileNode = fileNode; this.restoreIndex = restoreIndex; }
public RootDnSpyFileNodeCreator(IFileTreeView fileTreeView, IDnSpyFileNode asmNode) : this(fileTreeView, asmNode, true) { }
RootDnSpyFileNodeCreator(IFileTreeView fileTreeView, IDnSpyFileNode fileNode, bool restoreIndex) { this.fileTreeView = fileTreeView; this.fileNode = fileNode; this.restoreIndex = restoreIndex; }
bool CanSearchFile(IDnSpyFileNode node) => SearchSettings.SearchGacAssemblies || !GacInfo.IsGacPath(node.DnSpyFile.Filename);
RemoveAssemblyCommand(IFileTreeView fileTreeView, IDnSpyFileNode[] asmNodes) { this.savedStates = new RootDnSpyFileNodeCreator[asmNodes.Length]; for (int i = 0; i < this.savedStates.Length; i++) this.savedStates[i] = new RootDnSpyFileNodeCreator(fileTreeView, asmNodes[i]); }
AddExistingNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode) : base(undoCommandManager, asmNode, modNode, false) { }
protected AddNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode, bool modNodeWasCreated) { this.undoCommandManager = undoCommandManager; if (!(asmNode is IAssemblyFileNode)) { asmNode = (IAssemblyFileNode)asmNode.TreeNode.Parent.Data; } this.asmNode = (IAssemblyFileNode)asmNode; this.modNode = modNode; this.modNodeWasCreated = modNodeWasCreated; }
bool CanSearchFile(IDnSpyFileNode node) { return SearchSettings.SearchGacAssemblies || !GacInfo.IsGacPath(node.DnSpyFile.Filename); }
protected AddNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode, bool modNodeWasCreated) { this.undoCommandManager = undoCommandManager; if (!(asmNode is IAssemblyFileNode)) asmNode = (IAssemblyFileNode)asmNode.TreeNode.Parent.Data; this.asmNode = (IAssemblyFileNode)asmNode; this.modNode = modNode; this.modNodeWasCreated = modNodeWasCreated; }
AddNewNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode) : base(undoCommandManager, asmNode, modNode, true) { }
AddNewNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode) : base(undoCommandManager, asmNode, modNode, true) { }
AddExistingNetModuleToAssemblyCommand(IUndoCommandManager undoCommandManager, IDnSpyFileNode asmNode, IModuleFileNode modNode) : base(undoCommandManager, asmNode, modNode, false) { }
public IDnSpyFileNode Create(IFileTreeView fileTreeView, IDnSpyFileNode owner, IDnSpyFile file) { var myFile = file as MyDnSpyFile; if (myFile != null) return new MyDnSpyFileNode(myFile); return null; }
public UndoRedoInfo(IDnSpyFileNode node, bool isInUndo, bool isInRedo) { this.IsInUndo = isInUndo; this.IsInRedo = isInRedo; this.Node = node; }