示例#1
0
            //private bool showNotSerializableLabel;
            //private static GUIContent isNotSerializableLabel = new GUIContent("Not serializable ");

            public void PrependType(Type type)
            {
                if (this.ChildNodes == null)
                {
                    this.ChildNodes = new List <TypeTreeNode>();
                }
                var specialType = type == typeof(NullType) ? InstanceCreator.Type : type;
                var flag        = AssemblyUtilities.GetAssemblyTypeFlag(specialType.Assembly);
                var node        = this.ChildNodes.FirstOrDefault(x => x.AssemblyTypeFlag == flag);

                if (node == null)
                {
                    node = new TypeTreeNode()
                    {
                        AssemblyTypeFlag = flag
                    };
                    this.ChildNodes.Insert(0, node);
                }

                if (node.ChildNodes == null)
                {
                    node.ChildNodes = new List <TypeTreeNode>();
                }

                if (string.IsNullOrEmpty(specialType.Namespace))
                {
                    node.ChildNodes.Insert(0, new TypeTreeNode()
                    {
                        Type = type
                    });
                }
                else
                {
                    var nsNode = node.ChildNodes.FirstOrDefault(x => x.Namespace == specialType.Namespace);
                    if (nsNode == null)
                    {
                        nsNode = new TypeTreeNode()
                        {
                            Namespace = specialType.Namespace
                        };
                        node.ChildNodes.Insert(0, nsNode);
                    }

                    if (nsNode.ChildNodes == null)
                    {
                        nsNode.ChildNodes = new List <TypeTreeNode>();
                    }

                    nsNode.ChildNodes.Insert(0, new TypeTreeNode()
                    {
                        Type = type
                    });
                }
            }
示例#2
0
    internal static IEnumerable <Type> AncestorsAndSelf(Type type)
    {
        TypeTreeNode typeNode = _typeToNode[type];

        while (typeNode != null)
        {
            yield return(typeNode.Type);

            typeNode = typeNode.Parent;
        }
    }
示例#3
0
        void Search(DnSpyFile ownerModule, TypeDef type, MethodDef method)
        {
            var res = filter.GetFilterResult(method);

            if (res.FilterResult == FilterResult.Hidden)
            {
                return;
            }

            ImplMap im;

            if (res.IsMatch && (IsMatch(method.Name, method) || ((im = method.ImplMap) != null && (IsMatch(im.Name, im) || IsMatch(im.Module == null ? null : im.Module.Name, null)))))
            {
                onMatch(new SearchResult {
                    Language          = language,
                    Object            = method,
                    NameObject        = method,
                    TypeImageInfo     = MethodTreeNode.GetImageInfo(method, BackgroundType.Search),
                    LocationObject    = type,
                    LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
                    DnSpyFile         = ownerModule,
                });
                return;
            }

            res = filter.GetFilterResultParamDefs(method);
            if (res.FilterResult != FilterResult.Hidden)
            {
                foreach (var pd in method.ParamDefs)
                {
                    res = filter.GetFilterResult(method, pd);
                    if (res.FilterResult == FilterResult.Hidden)
                    {
                        continue;
                    }
                    if (res.IsMatch && IsMatch(pd.Name, pd))
                    {
                        onMatch(new SearchResult {
                            Language          = language,
                            Object            = method,
                            NameObject        = method,
                            TypeImageInfo     = MethodTreeNode.GetImageInfo(method, BackgroundType.Search),
                            LocationObject    = type,
                            LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
                            DnSpyFile         = ownerModule,
                        });
                        return;
                    }
                }
            }

            SearchBody(ownerModule, type, method);
        }
示例#4
0
        CreateTypeDefCommand(IList <TypeDef> ownerList, ILSpyTreeNode ownerNode, TypeDefOptions options)
        {
            this.ownerList = ownerList;
            var modNode = ILSpyTreeNode.GetNode <AssemblyTreeNode>(ownerNode);

            Debug.Assert(modNode != null);
            if (modNode == null)
            {
                throw new InvalidOperationException();
            }
            this.nsNodeCreator = new NamespaceTreeNodeCreator(options.Namespace, modNode);
            this.typeNode      = new TypeTreeNode(options.CreateTypeDef(modNode.DnSpyFile.ModuleDef), modNode.Parent as AssemblyTreeNode ?? modNode);
        }
示例#5
0
        CreateNestedTypeDefCommand(TypeTreeNode ownerType, TypeDefOptions options)
        {
            this.ownerType = ownerType;

            var modNode = ILSpyTreeNode.GetNode <AssemblyTreeNode>(ownerType);

            Debug.Assert(modNode != null);
            if (modNode == null)
            {
                throw new InvalidOperationException();
            }
            this.nestedType = new TypeTreeNode(options.CreateTypeDef(modNode.DnSpyFile.ModuleDef), modNode.Parent as AssemblyTreeNode ?? modNode);
        }
示例#6
0
        protected SearchResult ResultFromEntity(IEntity item)
        {
            var declaringType = item.DeclaringTypeDefinition;

            return(new SearchResult {
                Member = item,
                Fitness = CalculateFitness(item),
                Image = GetIcon(item),
                Name = GetLanguageSpecificName(item),
                LocationImage = declaringType != null?TypeTreeNode.GetIcon(declaringType) : Images.Namespace,
                                    Location = declaringType != null?language.TypeToString(declaringType, includeNamespace : true) : item.Namespace
            });
        }
示例#7
0
        private void OnGUI()
        {
            this.Focus();
            this.wantsMouseMove = true;

            if (InstanceCreator.Type == null)
            {
                this.Close();
                return;
            }
            else
            {
                this.RootNode = this.RootNode ?? this.GetTypeTree(InstanceCreator.Type);

                SirenixEditorGUI.BeginHorizontalToolbar(ToolbarBackgroundChainedTop);
                {
                    this.searchChanged = this.searchTerm != (this.searchTerm = SirenixEditorGUI.ToolbarSearchField(this.searchTerm, true)) || this.searchChanged;
                }
                SirenixEditorGUI.EndHorizontalToolbar();

                SirenixEditorGUI.BeginVerticalMenuList(this);
                {
                    this.RootNode.DrawItem();
                }
                SirenixEditorGUI.EndVerticalMenuList();

                SirenixEditorGUI.DrawBorders(new Rect(0, 0, this.position.width, this.position.height), 1, 1, 1, 1, SirenixGUIStyles.BorderColor);

                if (Event.current.type == EventType.Repaint)
                {
                    this.hasSearchTerm = this.searchTerm != null && (this.searchTerm.Length >= 2 || (this.searchTerm.Length == 1 && !char.IsLetter(this.searchTerm[0])));

                    if (this.searchChanged)
                    {
                        this.RootNode.UpdateSearchTerm();

                        this.searchChanged = false;
                    }
                }

                if (this.chosenType != null)
                {
                    this.SetSelectedType();
                    this.chosenType = null;
                    this.Close();
                    return;
                }

                this.RepaintIfRequested();
            }
        }
示例#8
0
        void Search(LoadedAssembly ownerModule, TypeDef type, MethodDef method)
        {
            var res = filter.GetFilterResult(method);

            if (res.FilterResult == FilterResult.Hidden)
            {
                return;
            }

            if (res.IsMatch && IsMatch(method.Name, method))
            {
                onMatch(new SearchResult {
                    Language          = language,
                    Object            = method,
                    NameObject        = method,
                    TypeImageInfo     = MethodTreeNode.GetImageInfo(method, BackgroundType.Search),
                    LocationObject    = type,
                    LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
                    LoadedAssembly    = ownerModule,
                });
                return;
            }

            res = filter.GetFilterResultParamDefs(method);
            if (res.FilterResult != FilterResult.Hidden)
            {
                foreach (var pd in method.ParamDefs)
                {
                    res = filter.GetFilterResult(method, pd);
                    if (res.FilterResult == FilterResult.Hidden)
                    {
                        continue;
                    }
                    if (res.IsMatch && IsMatch(pd.Name, pd))
                    {
                        onMatch(new SearchResult {
                            Language          = language,
                            Object            = method,
                            NameObject        = method,
                            TypeImageInfo     = MethodTreeNode.GetImageInfo(method, BackgroundType.Search),
                            LocationObject    = type,
                            LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
                            LoadedAssembly    = ownerModule,
                        });
                        return;
                    }
                }
            }

            SearchBody(ownerModule, type, method);
        }
示例#9
0
    public static TypeTreeNode MakeTree(IEnumerable <ClassNode> nodes, ClassNode parent)
    {
        TypeTreeNode parentNode = new TypeTreeNode();

        parentNode.Node = parent;
        foreach (var item in nodes)
        {
            if (item.ParentClasses.Any(m => m == parent.Name))
            {
                parentNode.Childs.Add(MakeTree(nodes, item));
            }
        }
        return(parentNode);
    }
示例#10
0
 internal void Initialize()
 {
     this.autoSelectFirst = Event.current != null && Event.current.modifiers == EventModifiers.Control;
     this.RootNode        = this.GetTypeTree(InstanceCreator.Type);
     if (this.chosenType != null)
     {
         this.SetSelectedType();
         this.chosenType = null;
     }
     else
     {
         this.titleContent = new GUIContent("Instance Creator");
         this.titleContent = new GUIContent("Create Instance of " + InstanceCreator.Type.GetNiceName());
     }
 }
示例#11
0
        public override void Search(TypeDefinition type, Language language, Action <SearchResult> addResult)
        {
            if (MatchName(type, language))
            {
                addResult(new SearchResult
                {
                    Member        = type,
                    Image         = TypeTreeNode.GetIcon(type),
                    Name          = language.TypeToString(type, includeNamespace: false),
                    LocationImage = type.DeclaringType != null ? TypeTreeNode.GetIcon(type.DeclaringType) : Images.Namespace,
                    Location      = type.DeclaringType != null ? language.TypeToString(type.DeclaringType, includeNamespace: true) : type.Namespace
                });
            }

            base.Search(type, language, addResult);
        }
示例#12
0
        public MemberSearchResult Create(IEntity entity)
        {
            var declaringType = entity.DeclaringTypeDefinition;

            return(new MemberSearchResult {
                Member = entity,
                Fitness = CalculateFitness(entity),
                Name = GetLanguageSpecificName(entity),
                Location = declaringType != null?language.TypeToString(declaringType, includeNamespace : true) : entity.Namespace,
                               Assembly = entity.ParentModule.FullAssemblyName,
                               ToolTip = entity.ParentModule.PEFile?.FileName,
                               Image = Images.Assembly,
                               LocationImage = declaringType != null?TypeTreeNode.GetIcon(declaringType) : Images.Namespace,
                                                   AssemblyImage = Images.Assembly,
            });
        }
示例#13
0
 /// <summary>
 /// Create node for a type (class or interface)
 /// - defer subnodes population to user selection
 /// </summary>
 /// <param name="nodes">In package</param>
 /// <param name="model">Model information</param>
 private void AddModel(TreeNodeCollection nodes, FileModel model)
 {
     if (model.Classes != null)
     {
         foreach (ClassModel aClass in model.Classes)
         {
             if (aClass.IndexType == null)
             {
                 TypeTreeNode node = new TypeTreeNode(aClass);
                 AddExplore(node);
                 allTypes.Add(node);
                 nodes.Add(node);
             }
         }
     }
 }
示例#14
0
 void Add <T>(IEnumerable <T> items, TypeDefinition type, Language language, Action <SearchResult> addResult, Func <T, bool> matcher, Func <T, ImageSource> image) where T : MemberReference
 {
     foreach (var item in items)
     {
         if (matcher(item))
         {
             addResult(new SearchResult
             {
                 Member        = item,
                 Image         = image(item),
                 Name          = item.Name,
                 LocationImage = TypeTreeNode.GetIcon(type),
                 Location      = language.TypeToString(type, includeNamespace: true)
             });
         }
     }
 }
示例#15
0
		void Search(LoadedAssembly ownerModule, TypeDef type, PropertyDef prop) {
			var res = filter.GetFilterResult(prop);
			if (res.FilterResult == FilterResult.Hidden)
				return;

			if (res.IsMatch && IsMatch(prop.Name, prop)) {
				onMatch(new SearchResult {
					Language = language,
					Object = prop,
					NameObject = prop,
					TypeImageInfo = PropertyTreeNode.GetImageInfo(prop, BackgroundType.Search),
					LocationObject = type,
					LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
					LoadedAssembly = ownerModule,
				});
			}
		}
示例#16
0
		void Search(LoadedAssembly ownerModule, TypeDef type, EventDef evt) {
			var res = filter.GetFilterResult(evt);
			if (res.FilterResult == FilterResult.Hidden)
				return;

			if (res.IsMatch && IsMatch(evt.Name, evt)) {
				onMatch(new SearchResult {
					Language = language,
					Object = evt,
					NameObject = evt,
					TypeImageInfo = EventTreeNode.GetImageInfo(evt, BackgroundType.Search),
					LocationObject = type,
					LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
					LoadedAssembly = ownerModule,
				});
			}
		}
示例#17
0
		void Search(LoadedAssembly ownerModule, TypeDef type, FieldDef field) {
			var res = filter.GetFilterResult(field);
			if (res.FilterResult == FilterResult.Hidden)
				return;

			ImplMap im;
			if (res.IsMatch && (IsMatch(field.Name, field) || ((im = field.ImplMap) != null && (IsMatch(im.Name, im) || IsMatch(im.Module == null ? null : im.Module.Name, null))))) {
				onMatch(new SearchResult {
					Language = language,
					Object = field,
					NameObject = field,
					TypeImageInfo = FieldTreeNode.GetImageInfo(field, BackgroundType.Search),
					LocationObject = type,
					LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
					LoadedAssembly = ownerModule,
				});
			}
		}
示例#18
0
		void Search(LoadedAssembly ownerModule, TypeDef type) {
			var res = filter.GetFilterResult(type);
			if (res.FilterResult == FilterResult.Hidden)
				return;

			if (res.IsMatch && (IsMatch(type.FullName, type) || IsMatch(type.Name, type))) {
				onMatch(new SearchResult {
					Language = language,
					Object = type,
					NameObject = type,
					TypeImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
					LocationObject = type.DeclaringType,
					LocationImageInfo = TypeTreeNode.GetImageInfo(type.DeclaringType, BackgroundType.Search),
					LoadedAssembly = ownerModule,
				});
			}

			SearchMembers(ownerModule, type);
		}
示例#19
0
		TypeDefSettingsCommand(ModuleDef module, TypeTreeNode typeNode, TypeDefOptions options)
		{
			this.module = module;
			this.typeNode = typeNode;
			this.newOptions = options;
			this.origOptions = new TypeDefOptions(typeNode.TypeDefinition);

			this.origParentNode = (ILSpyTreeNode)typeNode.Parent;
			this.origParentChildIndex = this.origParentNode.Children.IndexOf(typeNode);
			Debug.Assert(this.origParentChildIndex >= 0);
			if (this.origParentChildIndex < 0)
				throw new InvalidOperationException();

			this.nameChanged = origOptions.Name != newOptions.Name;
			if (this.origParentNode is NamespaceTreeNode) {
				var asmNode = (AssemblyTreeNode)this.origParentNode.Parent;
				if (AssemblyTreeNode.NamespaceStringComparer.Compare(newOptions.Namespace, origOptions.Namespace) != 0)
					this.nsNodeCreator = new NamespaceTreeNodeCreator(newOptions.Namespace, asmNode);
			}
		}
示例#20
0
        public override void Search(TypeDefinition type, Language language, Action <SearchResult> addResult)
        {
            if (MatchName(type, language))
            {
                string name = language.TypeToString(type, includeNamespace: false);
                addResult(new SearchResult {
                    Member        = type,
                    Fitness       = CalculateFitness(type, name),
                    Image         = TypeTreeNode.GetIcon(type),
                    Name          = name,
                    LocationImage = type.DeclaringType != null ? TypeTreeNode.GetIcon(type.DeclaringType) : Images.Namespace,
                    Location      = type.DeclaringType != null ? language.TypeToString(type.DeclaringType, includeNamespace: true) : type.Namespace
                });
            }

            foreach (TypeDefinition nestedType in type.NestedTypes)
            {
                Search(nestedType, language, addResult);
            }
        }
示例#21
0
 private static void BuildTypeTree(List <Type> types)
 {
     // One time pass through types to create initial node list.
     foreach (var type in types)
     {
         _typeToNode[type] = new TypeTreeNode(type);
     }
     // One more time build tree (adding child to parent).
     foreach (var type in _typeToNode.Keys)
     {
         if (_typeToNode.ContainsKey(type.BaseType))
         {
             // Found the parent so add child to parent.
             _typeToNode[type.BaseType].AddChild(_typeToNode[type]);
         }
         else
         {
             // If the base type is not found then it must be root.
             _root = _typeToNode[type];
         }
     }
 }
示例#22
0
        void Search(LoadedAssembly ownerModule, TypeDef type, FieldDef field)
        {
            var res = filter.GetFilterResult(field);

            if (res.FilterResult == FilterResult.Hidden)
            {
                return;
            }

            if (res.IsMatch && IsMatch(field.Name, field))
            {
                onMatch(new SearchResult {
                    Language          = language,
                    Object            = field,
                    NameObject        = field,
                    TypeImageInfo     = FieldTreeNode.GetImageInfo(field, BackgroundType.Search),
                    LocationObject    = type,
                    LocationImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
                    LoadedAssembly    = ownerModule,
                });
            }
        }
示例#23
0
        IBitmap GetIcon(IEntity member)
        {
            switch (member)
            {
            case ITypeDefinition t:
                return(TypeTreeNode.GetIcon(t));

            case IField f:
                return(FieldTreeNode.GetIcon(f));

            case IProperty p:
                return(PropertyTreeNode.GetIcon(p));

            case IMethod m:
                return(MethodTreeNode.GetIcon(m));

            case IEvent e:
                return(EventTreeNode.GetIcon(e));

            default:
                throw new NotSupportedException(member?.GetType() + " not supported!");
            }
        }
示例#24
0
        private void BuildInheritTypeTreeRecursively(INamedTypeSymbol typeSym)
        {
            string       key = ClassInfo.GetFullName(typeSym);
            TypeTreeNode typeTreeNode;

            if (!m_TypeTreeNodes.TryGetValue(key, out typeTreeNode))
            {
                typeTreeNode      = new TypeTreeNode();
                typeTreeNode.Type = typeSym;
                m_TypeTreeNodes.Add(key, typeTreeNode);
            }
            var baseType = typeSym.BaseType;

            if (null != baseType)
            {
                string baseClassKey = ClassInfo.GetFullName(baseType);
                if (baseClassKey == "System.Object" || baseClassKey == "System.ValueType")
                {
                }
                else
                {
                    TypeTreeNode baseTypeTreeNode;
                    if (!m_TypeTreeNodes.TryGetValue(baseClassKey, out baseTypeTreeNode))
                    {
                        baseTypeTreeNode      = new TypeTreeNode();
                        baseTypeTreeNode.Type = baseType;
                        m_TypeTreeNodes.Add(baseClassKey, baseTypeTreeNode);
                    }
                    typeTreeNode.BaseTypeNode = baseTypeTreeNode;
                    baseTypeTreeNode.ChildTypeNodes.Add(typeTreeNode);
                }
            }
            foreach (var newSym in typeSym.GetTypeMembers())
            {
                BuildInheritTypeTreeRecursively(newSym);
            }
        }
示例#25
0
        void Add <T>(Func <IEnumerable <T> > itemsGetter, TypeDefinition type, Language language, Action <SearchResult> addResult, Func <T, Language, bool> matcher, Func <T, ImageSource> image) where T : MemberReference
        {
            IEnumerable <T> items = Enumerable.Empty <T>();

            try {
                items = itemsGetter();
            } catch (Exception ex) {
                System.Diagnostics.Debug.Print(ex.ToString());
            }
            foreach (var item in items)
            {
                if (matcher(item, language))
                {
                    addResult(new SearchResult {
                        Member        = item,
                        Fitness       = CalculateFitness(item),
                        Image         = image(item),
                        Name          = GetLanguageSpecificName(language, (IMemberDefinition)item),
                        LocationImage = TypeTreeNode.GetIcon(type),
                        Location      = language.TypeToString(type, includeNamespace: true)
                    });
                }
            }
        }
示例#26
0
		void Search(LoadedAssembly ownerModule, string nsOwner, TypeDef type) {
			var res = filter.GetFilterResult(type);
			if (res.FilterResult == FilterResult.Hidden)
				return;

			if (res.IsMatch && (IsMatch(type.FullName, type) || IsMatch(type.Name, type))) {
				onMatch(new SearchResult {
					Language = language,
					Object = type,
					NameObject = type,
					TypeImageInfo = TypeTreeNode.GetImageInfo(type, BackgroundType.Search),
					LocationObject = new NamespaceSearchResult(nsOwner),
					LocationImageInfo = GetImage("Namespace"),
					LoadedAssembly = ownerModule,
				});
			}

			SearchMembers(ownerModule, type);

			foreach (var subType in type.GetTypes()) {
				cancellationToken.ThrowIfCancellationRequested();
				Search(ownerModule, subType);
			}
		}
示例#27
0
        protected override void LoadChildren()
        {
            ModuleDefinition moduleDefinition = assembly.ModuleDefinition;
            if (moduleDefinition == null)
            {
                // if we crashed on loading, then we don't have any children
                return;
            }

            foreach (NamespaceTreeNode ns in namespaces.Values)
            {
                ns.Children.Clear();
            }
            foreach (TypeDefinition type in moduleDefinition.Types.OrderBy(t => t.FullName))
            {
                NamespaceTreeNode ns;
                if (!namespaces.TryGetValue(type.Namespace, out ns))
                {
                    ns = new NamespaceTreeNode(type.Namespace);
                    namespaces[type.Namespace] = ns;
                }
                TypeTreeNode node = new TypeTreeNode(type, this);
                typeDict[type] = node;
                ns.Children.Add(node);
            }
            foreach (NamespaceTreeNode ns in namespaces.Values.OrderBy(n => n.Name))
            {
                if (ns.Children.Count > 0)
                    this.Children.Add(ns);
            }
        }
示例#28
0
 CreateEventDefCommand(TypeTreeNode ownerNode, EventDefOptions options)
 {
     this.ownerNode = ownerNode;
     this.eventNode = new EventTreeNode(options.CreateEventDef(ownerNode.TypeDef.Module));
 }
示例#29
0
 public static ImageSource GetIcon(TypeIcon icon, BackgroundType bgType)
 {
     return(TypeTreeNode.GetIcon(icon, bgType));
 }
示例#30
0
 /// <summary>
 /// Create a subnode to a type node to be populated later
 /// </summary>
 /// <param name="node"></param>
 private void AddExplore(TypeTreeNode node)
 {
     node.Nodes.Add(new ExploreTreeNode());
 }
示例#31
0
        /// <summary>
        /// Create node for a type (class or interface)
        /// - defer subnodes population to user selection
        /// </summary>
        /// <param name="nodes">In package</param>
        /// <param name="model">Model information</param>
        private void AddModel(TreeNodeCollection nodes, FileModel model)
        {
            if (model.Members != null)
                PluginUI.AddMembers(nodes, model.Members);

            if (model.Classes != null)
                foreach (ClassModel aClass in model.Classes) if (aClass.IndexType == null)
                {
                    TypeTreeNode node = new TypeTreeNode(aClass);
                    AddExplore(node);
                    allTypes.Add(node);
                    nodes.Add(node);
                }
        }
示例#32
0
            void PerformSearch(TypeDefinition type)
            {
                if (searchMode == SearchMode_Type && IsMatch(type.Name))
                {
                    AddResult(new SearchResult {
                        Member        = type,
                        Image         = TypeTreeNode.GetIcon(type),
                        Name          = language.TypeToString(type, includeNamespace: false),
                        LocationImage = type.DeclaringType != null ? TypeTreeNode.GetIcon(type.DeclaringType) : Images.Namespace,
                        Location      = type.DeclaringType != null ? language.TypeToString(type.DeclaringType, includeNamespace: true) : type.Namespace
                    });
                }

                foreach (TypeDefinition nestedType in type.NestedTypes)
                {
                    PerformSearch(nestedType);
                }

                if (searchMode == SearchMode_Type)
                {
                    return;
                }

                foreach (FieldDefinition field in type.Fields)
                {
                    if (IsMatch(field))
                    {
                        AddResult(new SearchResult {
                            Member        = field,
                            Image         = FieldTreeNode.GetIcon(field),
                            Name          = field.Name,
                            LocationImage = TypeTreeNode.GetIcon(type),
                            Location      = language.TypeToString(type, includeNamespace: true)
                        });
                    }
                }
                foreach (PropertyDefinition property in type.Properties)
                {
                    if (IsMatch(property))
                    {
                        AddResult(new SearchResult {
                            Member        = property,
                            Image         = PropertyTreeNode.GetIcon(property),
                            Name          = property.Name,
                            LocationImage = TypeTreeNode.GetIcon(type),
                            Location      = language.TypeToString(type, includeNamespace: true)
                        });
                    }
                }
                foreach (EventDefinition ev in type.Events)
                {
                    if (IsMatch(ev))
                    {
                        AddResult(new SearchResult {
                            Member        = ev,
                            Image         = EventTreeNode.GetIcon(ev),
                            Name          = ev.Name,
                            LocationImage = TypeTreeNode.GetIcon(type),
                            Location      = language.TypeToString(type, includeNamespace: true)
                        });
                    }
                }
                foreach (MethodDefinition method in type.Methods)
                {
                    switch (method.SemanticsAttributes)
                    {
                    case MethodSemanticsAttributes.Setter:
                    case MethodSemanticsAttributes.Getter:
                    case MethodSemanticsAttributes.AddOn:
                    case MethodSemanticsAttributes.RemoveOn:
                    case MethodSemanticsAttributes.Fire:
                        continue;
                    }
                    if (IsMatch(method))
                    {
                        AddResult(new SearchResult {
                            Member        = method,
                            Image         = MethodTreeNode.GetIcon(method),
                            Name          = method.Name,
                            LocationImage = TypeTreeNode.GetIcon(type),
                            Location      = language.TypeToString(type, includeNamespace: true)
                        });
                    }
                }
            }
示例#33
0
 CreatePropertyDefCommand(TypeTreeNode ownerNode, PropertyDefOptions options)
 {
     this.ownerNode = ownerNode;
     this.propNode  = new PropertyTreeNode(options.CreatePropertyDef(ownerNode.TypeDefinition.Module));
 }