Example #1
0
    private void DecorateDirectlyAttributed(MethodDecoratorEx.Fody.MethodDecorator decorator)
    {
        var markerTypeDefinitions = this.FindMarkerTypes();

        var methods = this.FindAttributedMethods(markerTypeDefinitions.ToArray());

        foreach (var x in methods)
        {
            decorator.Decorate(x.TypeDefinition, x.MethodDefinition, x.CustomAttribute);
        }
    }
Example #2
0
    private void DecorateAttributedByImplication(MethodDecoratorEx.Fody.MethodDecorator decorator)
    {
        var inderectAttributes = this.ModuleDefinition.CustomAttributes
                                 .Concat(this.ModuleDefinition.Assembly.CustomAttributes)
                                 .Where(x => x.AttributeType.Name.StartsWith("IntersectMethodsMarkedByAttribute"))
                                 .Select(ToHostAttributeMapping)
                                 .Where(x => x != null)
                                 .ToArray();

        foreach (var inderectAttribute in inderectAttributes)
        {
            var methods = this.FindAttributedMethods(inderectAttribute.AttribyteTypes);
            foreach (var x in methods)
            {
                decorator.Decorate(x.TypeDefinition, x.MethodDefinition, inderectAttribute.HostAttribute);
            }
        }
    }