public IMemberDefinition FindTargetOf(SecurityAttributeDescriptor descriptor)
 {
     switch (descriptor.Target)
     {
         case TargetKind.Type:
             return FindType(descriptor.Signature);
         case TargetKind.Method:
             return FindMethod(descriptor.Signature);
         default:
             throw new ArgumentException();
     }
 }
        public IMemberDefinition FindTargetOf(SecurityAttributeDescriptor descriptor)
        {
            switch (descriptor.Target)
            {
            case TargetKind.Type:
                return(FindType(descriptor.Signature));

            case TargetKind.Method:
                return(FindMethod(descriptor.Signature));

            default:
                throw new ArgumentException();
            }
        }
Example #3
0
        void ApplySecurityAttribute(SecurityAttributeDescriptor descriptor)
        {
            if (descriptor.Override != SecurityAttributeOverride.None)
            {
                throw new ArgumentException(string.Format("Security attribute overrides are not supported: {0}", descriptor));
            }

            ICustomAttributeProvider provider = FindTargetOf(descriptor);

            if (provider == null)
            {
                Console.Error.WriteLine("Member '{0}' not found in assembly '{1}'.", descriptor.Signature, _assembly.Name);
                return;
            }

            InjectAttributeOn(provider, descriptor.AttributeTypeName);
        }
Example #4
0
 ICustomAttributeProvider FindTargetOf(SecurityAttributeDescriptor descriptor)
 {
     return _cecilDefinitionFinder.FindTargetOf(descriptor);
 }
Example #5
0
        void ApplySecurityAttribute(SecurityAttributeDescriptor descriptor)
        {
            if (descriptor.Override != SecurityAttributeOverride.None)
                throw new ArgumentException(string.Format("Security attribute overrides are not supported: {0}", descriptor));

            ICustomAttributeProvider provider = FindTargetOf(descriptor);
            if (provider == null)
            {
                Console.Error.WriteLine("Member '{0}' not found in assembly '{1}'.", descriptor.Signature, _assembly.Name);
                return;
            }

            InjectAttributeOn(provider, descriptor.AttributeTypeName);
        }
Example #6
0
 ICustomAttributeProvider FindTargetOf(SecurityAttributeDescriptor descriptor)
 {
     return(_cecilDefinitionFinder.FindTargetOf(descriptor));
 }