예제 #1
0
        /// <exclude />
        public static IEnumerable <string> GetReferencableAssemblies()
        {
            string path = Path.GetDirectoryName(typeof(String).Assembly.Location);

            foreach (string file in Directory.GetFiles(path, "System*.dll"))
            {
                yield return(file);
            }

            foreach (string file in AssemblyFacade.GetAssembliesFromBin(true))
            {
                yield return(file);
            }
        }
        /// <exclude />
        public AttributeBasedApplicationStartupHandler()
        {
            List <AssemblyInfo> cachedTypesInfo = GetCachedAssemblyInfo();
            bool cacheHasBeenUpdated            = false;


            foreach (string filePath in AssemblyFacade.GetAssembliesFromBin())
            {
                StartupHandlerInfo[] types = null;
                try
                {
                    types = GetSubscribedTypes(filePath, cachedTypesInfo, ref cacheHasBeenUpdated);
                }
                catch (Exception e)
                {
                    LogAssemblyLoadException(filePath, e);
                }

                if (types != null)
                {
                    Subscribe(types);
                }
            }

            Assembly appCodeAsm = AssemblyFacade.GetAppCodeAssembly();

            if (appCodeAsm != null)
            {
                Subscribe(GetSubscribedTypes(appCodeAsm.GetTypes()));
            }

            if (cacheHasBeenUpdated)
            {
                SaveTypesCache(cachedTypesInfo);
            }
        }