Ejemplo n.º 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);
        }
    }
Ejemplo n.º 2
0
    public void Execute() {
        this.LogInfo = s => { };
        this.LogWarning = s => { };

        var decorator = new MethodDecoratorEx.Fody.MethodDecorator(this.ModuleDefinition);

        foreach (var x in this.ModuleDefinition.AssemblyReferences) AssemblyResolver.Resolve(x);

        this.DecorateDirectlyAttributed(decorator);
        this.DecorateAttributedByImplication(decorator);
    }
Ejemplo n.º 3
0
    public void Execute()
    {
        this.LogInfo    = s => { };
        this.LogWarning = s => { };

        var decorator = new MethodDecoratorEx.Fody.MethodDecorator(this.ModuleDefinition);

        foreach (var x in this.ModuleDefinition.AssemblyReferences)
        {
            AssemblyResolver.Resolve(x);
        }

        this.DecorateDirectlyAttributed(decorator);
        this.DecorateAttributedByImplication(decorator);
    }
Ejemplo n.º 4
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);
            }
        }
    }