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();
     }
 }
Пример #2
0
 ICustomAttributeProvider FindTargetOf(SecurityAttributeDescriptor descriptor)
 {
     return _cecilDefinitionFinder.FindTargetOf(descriptor);
 }
Пример #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);
        }