Exemple #1
0
        /// <summary>
        /// Returns a collection of all Durian modules that are enabled for the specified <paramref name="assembly"/>.
        /// </summary>
        /// <param name="assembly"><see cref="Assembly"/> to get all the enabled Durian modules of.</param>
        /// <returns>A new instance of <see cref="ModuleContainer"/> that contains the enabled Durian modules.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="assembly"/> is <see langword="null"/>.</exception>
        public static ModuleContainer GetEnabledModules(this Assembly assembly)
        {
            if (assembly is null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            ModuleContainer all = ModuleIdentity.GetAllModules();

            return(assembly.GetEnabledModules(all.AsEnums()));
        }
Exemple #2
0
        /// <summary>
        /// Determines whether the specified <paramref name="type"/> is enabled for the given <paramref name="assembly"/>.
        /// </summary>
        /// <param name="assembly"><see cref="Assembly"/> to check if the <paramref name="type"/> is enabled for.</param>
        /// <param name="type"><see cref="TypeIdentity"/> to check if is enabled.</param>
        /// <exception cref="ArgumentNullException"><paramref name="assembly"/> is <see langword="null"/>. -or- <paramref name="type"/> is <see langword="null"/>.</exception>
        public static bool IsEnabled(this Assembly assembly, TypeIdentity type)
        {
            if (assembly is null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            DurianModule[] modules = ModuleIdentity.GetAllModules().AsEnums();

            return(IsEnabled_Internal(assembly, type, modules));
        }
Exemple #3
0
        /// <summary>
        /// Returns a collection of <see cref="TypeIdentity"/>s representing all <see cref="Type"/>s declared in the <c>Durian.Core</c> package that are part of any existing Durian module.
        /// </summary>
        public static IEnumerable <TypeIdentity> GetAllTypes()
        {
            ModuleIdentity[] identities = ModuleIdentity.GetAllModules().AsIdentities();

            return(GetAllTypes(identities));
        }