public static IEnumerable<UsesFeatureAttribute> FromCustomAttributeProvider(ICustomAttributeProvider provider) { var attrs = provider.GetCustomAttributes ("Android.App.UsesFeatureAttribute"); foreach (var attr in attrs) { UsesFeatureAttribute self = new UsesFeatureAttribute (); if (attr.HasProperties) { // handle the case where the user sets additional properties self.specified = mapping.Load (self, attr); if (self.specified.Contains("GLESVersion") && self.GLESVersion==0) { throw new InvalidOperationException("Invalid value '0' for UsesFeatureAttribute.GLESVersion."); } } if (attr.HasConstructorArguments) { // in this case the user used one of the Consructors to pass arguments and possibly properties // so we only create the specified list if its not been created already if (self.specified == null) self.specified = new List<string>(); foreach(var arg in attr.ConstructorArguments) { if (arg.Value.GetType() == typeof(string)) { self.specified.Add("Name"); self.Name = (string)arg.Value; } } } yield return self; } }
public static IEnumerable <UsesFeatureAttribute> FromCustomAttributeProvider(ICustomAttributeProvider provider) { var attrs = provider.GetCustomAttributes("Android.App.UsesFeatureAttribute"); foreach (var attr in attrs) { UsesFeatureAttribute self = new UsesFeatureAttribute(); if (attr.HasProperties) { // handle the case where the user sets additional properties self.specified = mapping.Load(self, attr); if (self.specified.Contains("GLESVersion") && self.GLESVersion == 0) { throw new InvalidOperationException("Invalid value '0' for UsesFeatureAttribute.GLESVersion."); } } if (attr.HasConstructorArguments) { // in this case the user used one of the Consructors to pass arguments and possibly properties // so we only create the specified list if its not been created already if (self.specified == null) { self.specified = new List <string>(); } foreach (var arg in attr.ConstructorArguments) { if (arg.Value.GetType() == typeof(string)) { self.specified.Add("Name"); self.Name = (string)arg.Value; } } } yield return(self); } }