Пример #1
0
        public IEnumerable <AttributeResult <T> > FindAttributes <T>() where T : Attribute
        {
            var assemblies = loader.GetShadowAssemblies();

            var attributesFound = new List <AttributeResult <T> >();

            foreach (var assembly in assemblies)
            {
                var shadowAssemblyHash = assembly.ShadowAssembly.FullName;
                if (AttributeCache.ContainsKey <AttributeCache <T> >(shadowAssemblyHash))
                {
                    attributesFound.AddRange(AttributeCache.Get <AttributeCache <T> >(shadowAssemblyHash).Attributes);
                }
                else
                {
                    try
                    {
                        foreach (var type in assembly.ShadowAssembly.GetTypes())
                        {
                            FindPropertyAttributes(assembly, type, attributesFound);
                            FindMethodAttributes(assembly, type, attributesFound);
                            FindTypeAttributes(assembly, type, attributesFound);
                        }
                        AttributeCache.Set(shadowAssemblyHash, new AttributeCache <T>(assembly, attributesFound));
                    }
                    catch (Exception err3)
                    {
                        "CryoAOP -> Warning! First chance exception ocurred while searching for Mixin Methods. \r\n{0}"
                        .Warn(err3);
                    }
                }
            }
            return(attributesFound);
        }
Пример #2
0
        public void SetUp()
        {
            const string tempDir = @"c:\temp";

            Directory.GetFiles(tempDir).ToList().ForEach(File.Delete);

            if (Directory.Exists(tempDir))
                Directory.Delete(tempDir);

            assemblyLoader = new AssemblyLoader();
            shadowAssemblies = assemblyLoader.GetShadowAssemblies();
        }
Пример #3
0
        public void SetUp()
        {
            const string tempDir = @"c:\temp";

            Directory.GetFiles(tempDir).ToList().ForEach(File.Delete);

            if (Directory.Exists(tempDir))
            {
                Directory.Delete(tempDir);
            }

            assemblyLoader   = new AssemblyLoader();
            shadowAssemblies = assemblyLoader.GetShadowAssemblies();
        }