Ejemplo n.º 1
0
        public static bool HasAnyObsoleted(ICustomAttributeProvider item)
        {
            if (Skip(item))
            {
                return(false);
            }

            foreach (var attribute in item.CustomAttributes)
            {
                if (AttributeHelpers.HasObsoleted(attribute, Helpers.Platform))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public static bool HasAnyDeprecationForCurrentPlatform(ICustomAttributeProvider item)
        {
            if (Skip(item))
            {
                return(false);
            }

            // This allows us to accept [Deprecated (iOS)] for watch and tv, which many of our bindings currently have
            // If we want to force seperate tv\watch attributes remove GetRelatedPlatforms and just check Helpers.Platform
            Platforms[] platforms = GetRelatedPlatforms();
            foreach (var attribute in item.CustomAttributes)
            {
                if (platforms.Any(x => AttributeHelpers.HasDeprecated(attribute, x)) || platforms.Any(x => AttributeHelpers.HasObsoleted(attribute, x)))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static bool HasAnyDeprecationForCurrentPlatform(ICustomAttributeProvider item)
        {
            if (Skip(item))
            {
                return(false);
            }

            // This allows us to accept [Deprecated (iOS)] for watch and tv, which many of our bindings currently have
            // If we want to force seperate tv\watch attributes remove GetRelatedPlatforms and just check Helpers.Platform
            if (Helpers.IsDotNet)
            {
                foreach (var attribute in item.CustomAttributes)
                {
                    if (AttributeHelpers.HasObsolete(attribute, Helpers.Platform))
                    {
                        return(true);
                    }
                    // The only related platforms for .NET is iOS for Mac Catalyst
                    if (AttributeHelpers.HasUnsupportedOSPlatform(attribute, Helpers.Platform))
                    {
                        return(true);
                    }
                    if (Helpers.Platform == Platforms.MacCatalyst && AttributeHelpers.HasUnsupportedOSPlatform(attribute, Platforms.iOS))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                Platforms [] platforms = GetRelatedPlatforms();
                foreach (var attribute in item.CustomAttributes)
                {
                    if (platforms.Any(x => AttributeHelpers.HasDeprecated(attribute, x)) || platforms.Any(x => AttributeHelpers.HasObsoleted(attribute, x)))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }