private void FilterMembers()
        {
            filteredMembers.Clear();

            for (int i = 0; i < members.Count; i++)
            {
                var member = members[i];

                if (FlagsFilter != BindingFlags.Default)
                {
                    if (FlagsFilter == BindingFlags.Instance && member.IsStatic ||
                        FlagsFilter == BindingFlags.Static && !member.IsStatic)
                    {
                        continue;
                    }
                }

                if ((member is CacheMethod && !MemberFilter.HasFlag(MemberFlags.Method)) ||
                    (member is CacheField && !MemberFilter.HasFlag(MemberFlags.Field)) ||
                    (member is CacheProperty && !MemberFilter.HasFlag(MemberFlags.Property)))
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(NameFilter) && !member.NameForFiltering.ContainsIgnoreCase(NameFilter))
                {
                    continue;
                }

                filteredMembers.Add(member);
            }
        }
        public GraphElementSearcherDatabase AddMembers(
            IEnumerable <Type> types,
            MemberFlags memberFlags,
            BindingFlags bindingFlags,
            Dictionary <string, List <Type> > blackList = null
            )
        {
            foreach (Type type in types)
            {
                if (memberFlags.HasFlag(MemberFlags.Constructor))
                {
                    AddConstructors(type, bindingFlags);
                }

                if (memberFlags.HasFlag(MemberFlags.Field))
                {
                    AddFields(type, bindingFlags);
                }

                if (memberFlags.HasFlag(MemberFlags.Property))
                {
                    AddProperties(type, bindingFlags);
                }

                if (memberFlags.HasFlag(MemberFlags.Method))
                {
                    AddMethods(type, bindingFlags, blackList);
                }

                if (memberFlags.HasFlag(MemberFlags.Extension))
                {
                    AddExtensionMethods(type);
                }
            }

            return(this);
        }
示例#3
0
        public GraphElementSearcherDatabase AddMembers(
            IEnumerable <Type> types,
            MemberFlags memberFlags,
            BindingFlags bindingFlags
            )
        {
            foreach (Type type in types)
            {
                if (memberFlags.HasFlag(MemberFlags.Constructor))
                {
                    AddConstructors(type.GetConstructors(bindingFlags));
                }

                if (memberFlags.HasFlag(MemberFlags.Field))
                {
                    AddFields(type.GetFields(bindingFlags));
                }

                if (memberFlags.HasFlag(MemberFlags.Property))
                {
                    AddProperties(type.GetProperties(bindingFlags));
                }

                if (memberFlags.HasFlag(MemberFlags.Method))
                {
                    AddMethods(type.GetMethods(bindingFlags));
                }

                if (memberFlags.HasFlag(MemberFlags.Extension))
                {
                    AddExtensionMethods(type);
                }
            }

            return(this);
        }
示例#4
0
 internal bool HasFlag(MemberFlags flags)
 {
     return(_flags.HasFlag(flags));
 }