Ejemplo n.º 1
0
        AssemblySettingsCommand(IAssemblyDocumentNode asmNode, AssemblyOptions newOptions)
        {
            this.asmNode     = asmNode;
            this.newOptions  = newOptions;
            this.origOptions = new AssemblyOptions(asmNode.Document.AssemblyDef);

            if (newOptions.Name != origOptions.Name)
            {
                this.assemblyRefInfos = RefFinder.FindAssemblyRefsToThisModule(asmNode.Document.ModuleDef).Where(a => AssemblyNameComparer.NameAndPublicKeyTokenOnly.Equals(a, asmNode.Document.AssemblyDef)).Select(a => new AssemblyRefInfo(a)).ToArray();
            }
        }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
        void SearchAssemblyInternal(IAssemblyDocumentNode 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 <IModuleDocumentNode>().ToArray();

            foreach (var node in asmNode.TreeNode.DataChildren)
            {
                options.CancellationToken.ThrowIfCancellationRequested();
                var modNode = node as IModuleDocumentNode;
                if (modNode != null)
                {
                    SearchModule(modNode.Document);
                }
            }
        }
Ejemplo n.º 4
0
 RemoveNetModuleFromAssemblyCommand(Lazy <IUndoCommandService> undoCommandService, IModuleDocumentNode modNode)
 {
     this.undoCommandService = undoCommandService;
     this.asmNode            = (IAssemblyDocumentNode)modNode.TreeNode.Parent.Data;
     Debug.Assert(this.asmNode != null);
     this.modNode     = modNode;
     this.removeIndex = asmNode.TreeNode.DataChildren.ToList().IndexOf(modNode);
     Debug.Assert(this.removeIndex > 0);
     Debug.Assert(asmNode.Document.AssemblyDef != null &&
                  asmNode.Document.AssemblyDef.Modules.IndexOf(modNode.Document.ModuleDef) == this.removeIndex);
     this.removeIndexDocument = asmNode.Document.Children.IndexOf(modNode.Document);
     Debug.Assert(this.removeIndexDocument >= 0);
 }