Exemplo n.º 1
0
        public bool Test(TypeKey type, InheritMap map)
        {
            if (!string.IsNullOrEmpty(attrib))
            {
                if (string.Equals(attrib, "public", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (!MethodTester.IsTypePublic(type.TypeDefinition))
                    {
                        return(false);
                    }
                }
                else
                {
                    throw new ApplicationException(string.Format("'{0}' is not valid for the 'attrib' value of the SkipType element. Only 'public' is supported by now.", attrib));
                }
            }

            // type's regex matches
            if (nameRx != null && !nameRx.IsMatch(type.Fullname))
            {
                return(false);
            }

            // type's name matches
            if (!string.IsNullOrEmpty(name) && !Helper.CompareOptionalRegex(type.Fullname, name))
            {
                return(false);
            }

            if (isSerializable.HasValue)
            {
                if (isSerializable != type.TypeDefinition.IsSerializable)
                {
                    return(false);
                }
            }

            if (isStatic.HasValue)
            {
                if (isStatic != (type.TypeDefinition.IsSealed && type.TypeDefinition.IsAbstract))
                {
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(inherits))
            {
                if (!map.Inherits(type.TypeDefinition, inherits))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool Test(TypeKey type)
        {
            if (!string.IsNullOrEmpty(attrib))
            {
                if (string.Equals(attrib, "public", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (!MethodTester.IsTypePublic(type.TypeDefinition))
                    {
                        return(false);
                    }
                }
                else
                {
                    throw new ApplicationException(string.Format("'{0}' is not valid for the 'attrib' value of the SkipType element. Only 'public' is supported by now.", attrib));
                }
            }

            return(Helper.CompareOptionalRegex(type.Fullname, name));
        }