public static void Clear(CustomAttributeCollection customAttributes)
 {
     for (int i = customAttributes.Count - 1; i >= 0; i--)
     {
         if (Match(customAttributes[i]))
         {
             customAttributes.RemoveAt(i);
         }
     }
 }
        public static void RemoveMarkedAsStrip(CustomAttributeCollection customAttributes)
        {
            var attribute = new ObfuscationAttribute();

            for (int i = customAttributes.Count - 1; i >= 0; i--)
            {
                if (Match(customAttributes[i]))
                {
                    attribute.Load(customAttributes[i]);

                    if (attribute.StripAfterObfuscation)
                    {
                        customAttributes.RemoveAt(i);
                    }
                }
            }
        }
Пример #3
0
        static void RemoveSecurityAttributes(ICustomAttributeProvider provider)
        {
            RemoveSecurityDeclarations(provider as IHasSecurity);

            if (!provider.HasCustomAttributes)
            {
                return;
            }

            CustomAttributeCollection attributes = provider.CustomAttributes;

            for (int i = 0; i < attributes.Count; i++)
            {
                CustomAttribute attribute = attributes [i];
                switch (attribute.Constructor.DeclaringType.FullName)
                {
                case _safe_critical:
                case _critical:
                    attributes.RemoveAt(i--);
                    break;
                }
            }
        }