/// <summary>
		/// Creates a <see cref="NotifyDocumentTreeViewCollection.Add"/> instance
		/// </summary>
		/// <param name="document">Added document</param>
		/// <returns></returns>
		public static NotifyDocumentTreeViewCollectionChangedEventArgs CreateAdd(DsDocumentNode document) {
			Debug.Assert(document != null);
			var e = new NotifyDocumentTreeViewCollectionChangedEventArgs();
			e.Type = NotifyDocumentTreeViewCollection.Add;
			e.Nodes = new DsDocumentNode[] { document };
			return e;
		}
		/// <summary>
		/// Creates a <see cref="NotifyDocumentTreeViewCollection.Remove"/> instance
		/// </summary>
		/// <param name="documents">Removed documents</param>
		/// <returns></returns>
		public static NotifyDocumentTreeViewCollectionChangedEventArgs CreateRemove(DsDocumentNode[] documents) {
			Debug.Assert(documents != null);
			var e = new NotifyDocumentTreeViewCollectionChangedEventArgs();
			e.Type = NotifyDocumentTreeViewCollection.Remove;
			e.Nodes = documents;
			return e;
		}
		/// <summary>
		/// Creates a <see cref="NotifyDocumentTreeViewCollection.Clear"/> instance
		/// </summary>
		/// <param name="clearedDocuments">All cleared documents</param>
		/// <returns></returns>
		public static NotifyDocumentTreeViewCollectionChangedEventArgs CreateClear(DsDocumentNode[] clearedDocuments) {
			Debug.Assert(clearedDocuments != null);
			var e = new NotifyDocumentTreeViewCollectionChangedEventArgs();
			e.Type = NotifyDocumentTreeViewCollection.Clear;
			e.Nodes = clearedDocuments;
			return e;
		}
Beispiel #4
0
        /// <summary>
        /// Creates a <see cref="NotifyDocumentTreeViewCollection.Add"/> instance
        /// </summary>
        /// <param name="document">Added document</param>
        /// <returns></returns>
        public static NotifyDocumentTreeViewCollectionChangedEventArgs CreateAdd(DsDocumentNode document)
        {
            Debug.Assert(document != null);
            var e = new NotifyDocumentTreeViewCollectionChangedEventArgs();

            e.Type  = NotifyDocumentTreeViewCollection.Add;
            e.Nodes = new DsDocumentNode[] { document };
            return(e);
        }
		public static bool HasPENode(DsDocumentNode 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;
		}
		public DsDocumentNode Create(IDocumentTreeView documentTreeView, DsDocumentNode owner, IDsDocument document) {
			var dnDocument = document as IDsDotNetDocument;
			if (dnDocument != null) {
				Debug.Assert(document.ModuleDef != null);
				if (document.AssemblyDef == null || owner != null)
					return new ModuleDocumentNodeImpl(dnDocument);
				return new AssemblyDocumentNodeImpl(dnDocument);
			}
			Debug.Assert(document.AssemblyDef == null && document.ModuleDef == null);
			if (document.PEImage != null)
				return new PEDocumentNodeImpl(document);

			return null;
		}
		RootDocumentNodeCreator(IDocumentTreeView documentTreeView, DsDocumentNode fileNode, bool restoreIndex) {
			this.documentTreeView = documentTreeView;
			documentNode = fileNode;
			this.restoreIndex = restoreIndex;
		}
		public RootDocumentNodeCreator(IDocumentTreeView documentTreeView, DsDocumentNode asmNode)
			: this(documentTreeView, asmNode, true) {
		}
Beispiel #9
0
		bool CanSearchFile(DsDocumentNode node) =>
			SearchSettings.SearchGacAssemblies || !GacInfo.IsGacPath(node.Document.Filename);
Beispiel #10
0
		public DsDocumentNode Create(IDocumentTreeView documentTreeView, DsDocumentNode owner, IDsDocument document) {
			var myDocument = document as MyDsDocument;
			if (myDocument != null)
				return new MyDsDocumentNode(myDocument);
			return null;
		}
Beispiel #11
0
		RemoveAssemblyCommand(IDocumentTreeView documentTreeView, DsDocumentNode[] asmNodes) {
			savedStates = new RootDocumentNodeCreator[asmNodes.Length];
			for (int i = 0; i < savedStates.Length; i++)
				savedStates[i] = new RootDocumentNodeCreator(documentTreeView, asmNodes[i]);
		}
Beispiel #12
0
			public UndoRedoInfo(DsDocumentNode node, bool isInUndo, bool isInRedo) {
				IsInUndo = isInUndo;
				IsInRedo = isInRedo;
				Node = node;
			}
Beispiel #13
0
		AddExistingNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
			: base(undoCommandService, asmNode, modNode, false) {
		}
Beispiel #14
0
		AddNewNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
			: base(undoCommandService, asmNode, modNode, true) {
		}
Beispiel #15
0
		protected AddNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode, bool modNodeWasCreated) {
			this.undoCommandService = undoCommandService;
			if (!(asmNode is AssemblyDocumentNode))
				asmNode = (AssemblyDocumentNode)asmNode.TreeNode.Parent.Data;
			this.asmNode = (AssemblyDocumentNode)asmNode;
			this.modNode = modNode;
			this.modNodeWasCreated = modNodeWasCreated;
		}