示例#1
0
        /// <summary>
        /// Return a list of found local Assemblies in the bin folder exluding the ones passed in and excluding the exclusion list filter
        /// </summary>
        /// <param name="excludeFromResults"></param>
        /// <returns></returns>
        public static IEnumerable <Assembly> GetFilteredBinFolderAssemblies(IEnumerable <Assembly> excludeFromResults = null)
        {
            if (excludeFromResults == null)
            {
                excludeFromResults = new List <Assembly>();
            }

            return(GetBinFolderAssemblies()
                   .Where(x => !excludeFromResults.Contains(x) &&
                          !x.GlobalAssemblyCache &&
                          !KnownAssemblyExclusionFilter.Any(f => x.FullName.StartsWith(f))));
        }
示例#2
0
 public static IEnumerable <Assembly> GetLocalAssembliesWithKnownExclusions(IEnumerable <Assembly> excludeFromResults = null)
 {
     if (_localFilteredAssemblyCache.Any())
     {
         return(_localFilteredAssemblyCache);
     }
     using (new WriteLockDisposable(_localFilteredAssemblyCacheLocker))
     {
         var assemblies = GetAllAssemblies()
                          .Where(x => !x.GlobalAssemblyCache &&
                                 !KnownAssemblyExclusionFilter.Any(f => x.FullName.StartsWith(f)));
         assemblies.ForEach(_localFilteredAssemblyCache.Add);
     }
     return(_localFilteredAssemblyCache);
 }
示例#3
0
文件: Helper.cs 项目: laniatech/MCFly
        public static IEnumerable <FieldType> EnsureMCFlyFieldTypes()
        {
            var fieldTypes =
                from a in AppDomain.CurrentDomain.GetAssemblies().Where(x => KnownAssemblyExclusionFilter.Any(f => x.FullName.StartsWith(f)) == false)
                from t in a.GetTypes()
                where t.IsSubclassOf(typeof(FieldType)) && !t.IsAbstract && t.IsClass
                select(FieldType) Activator.CreateInstance(t);

            // Ensure unique names
            var names = new List <string>();

            foreach (var t in fieldTypes)
            {
                if (names.Any(x => x == t.Name))
                {
                    throw new ApplicationException("Multiple MCFly fieldtypes found with name '" + t.Name + "'. Please ensure all types have a unique name value.");
                }

                names.Add(t.Name);
            }

            HttpRuntime.Cache.Insert("MCFlyFieldTypes", fieldTypes.OrderBy(x => x.Name));
            return(fieldTypes.OrderBy(x => x.Name));
        }