Beispiel #1
0
        private static void HandleMethod(HandleMethodArgs args)
        {
            Globals.Loggers.File.Debug("Handling method {0}.", args.MethodDefinition.FullName);
            if (args.MethodDefinition.HasCustomAttributes)
            {
                Globals.Loggers.File.Trace("Handling method custom attributes.");
                for (var i = 0; i < args.MethodDefinition.CustomAttributes.Count; i++)
                {
                    var attribute           = args.MethodDefinition.CustomAttributes[i];
                    var handleAttributeArgs = new HandleMethodAttributeArgs
                    {
                        CustomAttribute      = attribute,
                        MethodAttributeNames = args.MethodAttributeNames,
                        MethodDefinition     = args.MethodDefinition
                    };

                    if (HandleMethodAttribute(handleAttributeArgs))
                    {
                        i--;
                    }
                }
            }
            else
            {
                Globals.Loggers.File.Trace("Method does not has custom attributes.");
            }
        }
Beispiel #2
0
        private static void HandleMethod(HandleMethodArgs args)
        {
            Globals.Loggers.File.Debug("Handling method {0}.", args.MethodDefinition.FullName);
            if (args.MethodDefinition.HasCustomAttributes)
            {
                Globals.Loggers.File.Trace("Handling method custom attributes.");
                for (var i = 0; i < args.MethodDefinition.CustomAttributes.Count; i++ )
                {
                    var attribute = args.MethodDefinition.CustomAttributes[i];
                    var handleAttributeArgs = new HandleMethodAttributeArgs
                    {
                        CustomAttribute = attribute,
                        MethodAttributeNames = args.MethodAttributeNames,
                        MethodDefinition = args.MethodDefinition
                    };

                    if (HandleMethodAttribute(handleAttributeArgs))
                    {
                        i--;
                    }
                }
            }
            else
            {
                Globals.Loggers.File.Trace("Method does not has custom attributes.");
            }
        }
Beispiel #3
0
        static void HandleType(HandleTypeArgs args)
        {
            Globals.Loggers.File.Trace("Handling {0} type.", args.TypeDefinition.FullName);
            if (args.TypeDefinition.HasMethods)
            {
                if (args.TypeDefinition.HasCustomAttributes)
                {
                    Globals.Loggers.File.Trace("Handling type custom attributes.");
                    for (var i = 0; i < args.TypeDefinition.CustomAttributes.Count; i++)
                    {
                        var handleArgs = new HandleClassAttributeArgs
                        {
                            ClassAttributeNames = args.ClassAttributeNames,
                            CustomAttribute     = args.TypeDefinition.CustomAttributes[i],
                            TypeDefinition      = args.TypeDefinition
                        };

                        if (HandleTypeAttribute(handleArgs))
                        {
                            i--;
                        }
                    }
                }
                else
                {
                    Globals.Loggers.File.Trace("Type does not has custom attributes.");
                }

                Globals.Loggers.File.Trace("Handling methods.");
                for (var i = 0; i < args.TypeDefinition.Methods.Count; i++)
                {
                    var handleArgs = new HandleMethodArgs
                    {
                        MethodAttributeNames = args.MethodAttributeNames,
                        MethodDefinition     = args.TypeDefinition.Methods[i]
                    };
                    HandleMethod(handleArgs);
                }
            }
            else
            {
                Globals.Loggers.File.Trace("Type does not has methods.");
            }
        }
Beispiel #4
0
        static void HandleType(HandleTypeArgs args)
        {
            Globals.Loggers.File.Trace("Handling {0} type.", args.TypeDefinition.FullName);
            if (args.TypeDefinition.HasMethods)
            {
                if (args.TypeDefinition.HasCustomAttributes)
                {
                    Globals.Loggers.File.Trace("Handling type custom attributes.");
                    for (var i = 0; i < args.TypeDefinition.CustomAttributes.Count; i++ )
                    {
                        var handleArgs = new HandleClassAttributeArgs
                        {
                            ClassAttributeNames = args.ClassAttributeNames,
                            CustomAttribute = args.TypeDefinition.CustomAttributes[i],
                            TypeDefinition = args.TypeDefinition
                        };

                        if (HandleTypeAttribute(handleArgs))
                        {
                            i--;
                        }
                    }
                }
                else
                {
                    Globals.Loggers.File.Trace("Type does not has custom attributes.");
                }

                Globals.Loggers.File.Trace("Handling methods.");
                for (var i = 0; i < args.TypeDefinition.Methods.Count; i++)
                {
                    var handleArgs = new HandleMethodArgs
                    {
                        MethodAttributeNames = args.MethodAttributeNames,
                        MethodDefinition = args.TypeDefinition.Methods[i]
                    };
                    HandleMethod(handleArgs);
                }
            }
            else
            {
                Globals.Loggers.File.Trace("Type does not has methods.");
            }
        }