Exemple #1
0
        /// <summary>
        /// Creates a <see cref="NotifyDocumentTreeViewCollection.Add"/> instance
        /// </summary>
        /// <param name="document">Added document</param>
        /// <returns></returns>
        public static NotifyDocumentTreeViewCollectionChangedEventArgs CreateAdd(IDsDocumentNode document)
        {
            Debug.Assert(document != null);
            var e = new NotifyDocumentTreeViewCollectionChangedEventArgs();

            e.Type  = NotifyDocumentTreeViewCollection.Add;
            e.Nodes = new IDsDocumentNode[] { document };
            return(e);
        }
        void OnNodeRemoved(IDsDocumentNode node)
        {
            var hash = GetSelfAndDsDocumentNodeChildren(node);

            foreach (TabContentImpl tab in VisibleFirstTabs)
            {
                tab.OnNodesRemoved(hash, () => this.CreateTabContent(Array.Empty <IDocumentTreeNodeData>()));
            }
            decompilationCache.Clear(new HashSet <IDsDocument>(hash.Select(a => a.Document)));
        }
Exemple #3
0
        public IDsDocumentNode Create(IDocumentTreeView documentTreeView, IDsDocumentNode owner, IDsDocument document)
        {
            var myDocument = document as MyDsDocument;

            if (myDocument != null)
            {
                return(new MyDsDocumentNode(myDocument));
            }
            return(null);
        }
Exemple #4
0
 public void AddNode(IDsDocumentNode documentNode, int index)
 {
     if (documentNode == null)
     {
         throw new ArgumentNullException(nameof(documentNode));
     }
     Debug.Assert(!TreeView.Root.DataChildren.Contains(documentNode));
     Debug.Assert(documentNode.TreeNode.Parent == null);
     DocumentService.ForceAdd(documentNode.Document, false, new AddDocumentInfo(documentNode, index));
     Debug.Assert(TreeView.Root.DataChildren.Contains(documentNode));
 }
Exemple #5
0
        public IDsDocumentNode CreateNode(IDsDocumentNode owner, IDsDocument document)
        {
            foreach (var provider in dsDocumentNodeProvider)
            {
                var result = provider.Value.Create(this, owner, document);
                if (result != null)
                {
                    return(result);
                }
            }

            return(new UnknownDocumentNode(document));
        }
        public static bool HasPENode(IDsDocumentNode node)
        {
            if (node == null)
            {
                return(false);
            }

            var peImage = node.Document.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.Document.Key is FilenameKey;

            return(loadedFromFile && peImage != null);
        }
 static HashSet <IDsDocumentNode> GetSelfAndDsDocumentNodeChildren(IDsDocumentNode node, HashSet <IDsDocumentNode> hash = null)
 {
     if (hash == null)
     {
         hash = new HashSet <IDsDocumentNode>();
     }
     hash.Add(node);
     foreach (var c in node.TreeNode.DataChildren)
     {
         var documentNode = c as IDsDocumentNode;
         if (documentNode != null)
         {
             GetSelfAndDsDocumentNodeChildren(documentNode, hash);
         }
     }
     return(hash);
 }
Exemple #8
0
        public IDsDocumentNode Create(IDocumentTreeView documentTreeView, IDsDocumentNode owner, IDsDocument document)
        {
            var dnDocument = document as IDsDotNetDocument;

            if (dnDocument != null)
            {
                Debug.Assert(document.ModuleDef != null);
                if (document.AssemblyDef == null || owner != null)
                {
                    return(new ModuleDocumentNode(dnDocument));
                }
                return(new AssemblyDocumentNode(dnDocument));
            }
            Debug.Assert(document.AssemblyDef == null && document.ModuleDef == null);
            if (document.PEImage != null)
            {
                return(new PEDocumentNode(document));
            }

            return(null);
        }
Exemple #9
0
 public UndoRedoInfo(IDsDocumentNode node, bool isInUndo, bool isInRedo)
 {
     this.IsInUndo = isInUndo;
     this.IsInRedo = isInRedo;
     this.Node     = node;
 }
Exemple #10
0
 public AddDocumentInfo(IDsDocumentNode documentNode, int index)
 {
     this.DsDocumentNode = documentNode;
     this.Index          = index;
 }
Exemple #11
0
 AddExistingNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, IDsDocumentNode asmNode, IModuleDocumentNode modNode)
     : base(undoCommandService, asmNode, modNode, false)
 {
 }
Exemple #12
0
 AddNewNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, IDsDocumentNode asmNode, IModuleDocumentNode modNode)
     : base(undoCommandService, asmNode, modNode, true)
 {
 }
Exemple #13
0
 protected AddNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, IDsDocumentNode asmNode, IModuleDocumentNode modNode, bool modNodeWasCreated)
 {
     this.undoCommandService = undoCommandService;
     if (!(asmNode is IAssemblyDocumentNode))
     {
         asmNode = (IAssemblyDocumentNode)asmNode.TreeNode.Parent.Data;
     }
     this.asmNode           = (IAssemblyDocumentNode)asmNode;
     this.modNode           = modNode;
     this.modNodeWasCreated = modNodeWasCreated;
 }
Exemple #14
0
 bool CanSearchFile(IDsDocumentNode node) =>
 SearchSettings.SearchGacAssemblies || !GacInfo.IsGacPath(node.Document.Filename);
Exemple #15
0
 RootDocumentNodeCreator(IDocumentTreeView documentTreeView, IDsDocumentNode fileNode, bool restoreIndex)
 {
     this.documentTreeView = documentTreeView;
     this.documentNode     = fileNode;
     this.restoreIndex     = restoreIndex;
 }
Exemple #16
0
 public RootDocumentNodeCreator(IDocumentTreeView documentTreeView, IDsDocumentNode asmNode)
     : this(documentTreeView, asmNode, true)
 {
 }