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); } }
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); }
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); }
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); } } }