static IEnumerable <System.Attribute> ConvertOldAttributes(CustomAttributeData attribute) { switch (attribute.AttributeType.Namespace) { case null: // Root namespace such as PlatformAvailabilityShadow.cs case "MonoTouch.ObjCRuntime": case "ObjCRuntime": break; default: return(Enumerable.Empty <System.Attribute> ()); } switch (attribute.AttributeType.Name) { case "SinceAttribute": case "iOSAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.iOS).Yield()); case "MacAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.MacOSX).Yield()); case "WatchAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.WatchOS).Yield()); case "TVAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.TvOS).Yield()); case "LionAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 7).Yield()); case "MountainLionAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 8).Yield()); case "MavericksAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 9).Yield()); case "NoMacAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.MacOSX).Yield()); case "NoiOSAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.iOS).Yield()); case "NoWatchAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.WatchOS).Yield()); case "NoTVAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.TvOS).Yield()); case "AvailabilityAttribute": return(AttributeConversionManager.ConvertAvailability(attribute)); default: return(Enumerable.Empty <System.Attribute> ()); } }
static IEnumerable <System.Attribute> ConvertOldAttributes(CustomAttributeData attribute) { switch (attribute.GetAttributeType().Namespace) { case null: // Root namespace such as PlatformAvailabilityShadow.cs case "MonoTouch.ObjCRuntime": case "ObjCRuntime": #if NET case "System.Runtime.Versioning": #endif break; default: return(Enumerable.Empty <System.Attribute> ()); } switch (attribute.GetAttributeType().Name) { case "SinceAttribute": case "iOSAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.iOS).Yield()); case "MacAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.MacOSX).Yield()); case "WatchAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.WatchOS).Yield()); case "TVAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.TvOS).Yield()); case "MacCatalystAttribute": return(AttributeConversionManager.ConvertPlatformAttribute(attribute, PlatformName.MacCatalyst).Yield()); case "LionAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 7).Yield()); case "MountainLionAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 8).Yield()); case "MavericksAttribute": return(AttributeFactory.CreateNewIntroducedAttribute(PlatformName.MacOSX, 10, 9).Yield()); case "NoMacAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.MacOSX).Yield()); case "NoiOSAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.iOS).Yield()); case "NoWatchAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.WatchOS).Yield()); case "NoTVAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.TvOS).Yield()); case "NoMacCatalystAttribute": return(AttributeFactory.CreateUnavailableAttribute(PlatformName.MacCatalyst).Yield()); case "AvailabilityAttribute": return(AttributeConversionManager.ConvertAvailability(attribute)); #if NET case "SupportedOSPlatformAttribute": var sarg = attribute.ConstructorArguments [0].Value as string; (var sp, var sv) = ParseOSPlatformAttribute(sarg); return(AttributeFactory.CreateNewIntroducedAttribute(sp, sv.Major, sv.Minor).Yield()); case "UnsupportedOSPlatformAttribute": var uarg = attribute.ConstructorArguments [0].Value as string; (var up, var uv) = ParseOSPlatformAttribute(uarg); // might have been available for a while... if (uv == null) { return(AttributeFactory.CreateUnavailableAttribute(up).Yield()); } else { return(Enumerable.Empty <System.Attribute> ()); } #endif default: return(Enumerable.Empty <System.Attribute> ()); } }