Exemple #1
0
        private static void FindTypeAttributes <T>(ShadowAssemblyType shadowAssembly, System.Type type,
                                                   List <AttributeResult <T> > attributesFound) where T : Attribute
        {
            try
            {
                var typeAttributes =
                    type
                    .GetCustomAttributes(true)
                    .Where(
                        attr =>
                        attr.GetType().FullName == typeof(T).FullName)
                    .ToList();

                if (typeAttributes.Count > 0)
                {
                    var attribute = typeAttributes.Cast <T>().First();
                    var info      = new AttributeResult <T>(shadowAssembly, type, attribute);
                    attributesFound.Add(info);
                }
            }
            catch (Exception err1)
            {
                "CryoAOP -> Warning! First chance exception ocurred while searching for Mixin Methods. \r\n{0}"
                .Warn(err1);
            }
        }
Exemple #2
0
 public AttributeResult(ShadowAssemblyType shadowAssembly, System.Type type, PropertyInfo property, T attribute)
 {
     Type           = type;
     Property       = property;
     Attribute      = attribute;
     ShadowAssembly = shadowAssembly;
 }
Exemple #3
0
 public AttributeResult(ShadowAssemblyType shadowAssembly, System.Type type, MethodInfo method, T attribute)
 {
     Type           = type;
     Method         = method;
     Attribute      = attribute;
     ShadowAssembly = shadowAssembly;
 }
Exemple #4
0
        private static void FindMethodAttributes <T>(ShadowAssemblyType shadowAssembly, System.Type type,
                                                     List <AttributeResult <T> > attributesFound) where T : Attribute
        {
            try
            {
                var methods =
                    type.GetMethods(
                        BindingFlags.Public
                        | BindingFlags.NonPublic
                        | BindingFlags.Static
                        | BindingFlags.Instance);

                foreach (var method in methods)
                {
                    try
                    {
                        var methodAttributes =
                            method
                            .GetCustomAttributes(true)
                            .Where(
                                attr =>
                                attr.GetType().FullName == typeof(T).FullName)
                            .ToList();

                        if (methodAttributes.Count > 0)
                        {
                            var attribute = methodAttributes.Cast <T>().First();
                            var info      = new AttributeResult <T>(shadowAssembly, type, method, attribute);
                            attributesFound.Add(info);
                        }
                    }
                    catch (Exception err)
                    {
                        "CryoAOP -> Warning! First chance exception ocurred while searching for Mixin Methods. \r\n{0}"
                        .Warn(err);
                    }
                }
            }
            catch (Exception err2)
            {
                "CryoAOP -> Warning! First chance exception ocurred while searching for Mixin Methods. \r\n{0}"
                .Warn(err2);
            }
        }
Exemple #5
0
 public AttributeResult(ShadowAssemblyType shadowAssembly, System.Type type, T attribute)
 {
     Type           = type;
     Attribute      = attribute;
     ShadowAssembly = shadowAssembly;
 }
Exemple #6
0
 public AttributeCache(ShadowAssemblyType shadowAssembly, List <AttributeResult <T> > attributes)
 {
     ShadowAssembly = shadowAssembly;
     Attributes     = attributes;
 }