Exemplo n.º 1
0
		void SearchAssemblyInternal(AssemblyDocumentNode asmNode) {
			if (asmNode == null)
				return;
			var asm = asmNode.Document.AssemblyDef;
			Debug.Assert(asm != null);
			if (asm == null)
				return;
			var res = options.Filter.GetResult(asm);
			if (res.FilterType == FilterType.Hide)
				return;
			CheckCustomAttributes(asmNode.Document, asm, null);

			if (res.IsMatch && (IsMatch(asm.FullName, asmNode.Document) || IsMatch(asm.Name, null))) {
				options.OnMatch(new SearchResult {
					Context = options.Context,
					Object = asm,
					NameObject = asm,
					ObjectImageReference = options.DotNetImageService.GetImageReference(asmNode.Document.ModuleDef),
					LocationObject = null,
					LocationImageReference = new ImageReference(),
					Document = asmNode.Document,
				});
			}

			if (asmNode.TreeNode.LazyLoading) {
				options.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => {
					asmNode.TreeNode.EnsureChildrenLoaded();
				}));
			}
			var modChildren = asmNode.TreeNode.DataChildren.OfType<ModuleDocumentNode>().ToArray();

			foreach (var node in asmNode.TreeNode.DataChildren) {
				options.CancellationToken.ThrowIfCancellationRequested();
				var modNode = node as ModuleDocumentNode;
				if (modNode != null)
					SearchModule(modNode.Document);
			}
		}
Exemplo n.º 2
0
		RemoveNetModuleFromAssemblyCommand(Lazy<IUndoCommandService> undoCommandService, ModuleDocumentNode modNode) {
			this.undoCommandService = undoCommandService;
			asmNode = (AssemblyDocumentNode)modNode.TreeNode.Parent.Data;
			Debug.Assert(asmNode != null);
			this.modNode = modNode;
			removeIndex = asmNode.TreeNode.DataChildren.ToList().IndexOf(modNode);
			Debug.Assert(removeIndex > 0);
			Debug.Assert(asmNode.Document.AssemblyDef != null &&
				asmNode.Document.AssemblyDef.Modules.IndexOf(modNode.Document.ModuleDef) == removeIndex);
			removeIndexDocument = asmNode.Document.Children.IndexOf(modNode.Document);
			Debug.Assert(removeIndexDocument >= 0);
		}
Exemplo n.º 3
0
		AssemblySettingsCommand(AssemblyDocumentNode asmNode, AssemblyOptions newOptions) {
			this.asmNode = asmNode;
			this.newOptions = newOptions;
			origOptions = new AssemblyOptions(asmNode.Document.AssemblyDef);

			if (newOptions.Name != origOptions.Name)
				assemblyRefInfos = RefFinder.FindAssemblyRefsToThisModule(asmNode.Document.ModuleDef).Where(a => AssemblyNameComparer.NameAndPublicKeyTokenOnly.Equals(a, asmNode.Document.AssemblyDef)).Select(a => new AssemblyRefInfo(a)).ToArray();
		}
Exemplo n.º 4
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;
		}