コード例 #1
0
 /// <summary>
 /// Determines whether the specified <paramref name="type"/> is enabled for the calling <see cref="Assembly"/>.
 /// </summary>
 /// <param name="type"><see cref="TypeIdentity"/> to check if is enabled.</param>
 /// <param name="modules"><see cref="ModuleContainer"/> that provides a collection of Durian modules to pick the <see cref="TypeIdentity"/>s from.</param>
 /// <exception cref="ArgumentNullException"><paramref name="type"/> is <see langword="null"/>. -or- <paramref name="modules"/> is <see langword="null"/>.</exception>
 public static bool IsEnabled(TypeIdentity type, ModuleContainer modules)
 {
     return(Assembly.GetCallingAssembly().IsEnabled(type, modules));
 }
コード例 #2
0
        /// <summary>
        /// Returns a collection of <see cref="TypeIdentity"/>s representing all disabled Durian <see cref="Type"/>s for the specified <paramref name="assembly"/> that are part of any of the provided <paramref name="modules"/>.
        /// </summary>
        /// <param name="assembly"><see cref="Assembly"/> to get the disabled Durian <see cref="Type"/>s of.</param>
        /// <param name="modules"><see cref="ModuleContainer"/> that provides a collection of Durian modules to pick the <see cref="TypeIdentity"/>s from.</param>
        /// <exception cref="ArgumentNullException"><paramref name="assembly"/> is <see langword="null"/>. -or- <paramref name="modules"/> is <see langword="null"/>.</exception>
        public static IEnumerable <TypeIdentity> GetDisabledTypes(this Assembly assembly, ModuleContainer modules)
        {
            if (assembly is null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

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

            if (modules.Count == 0)
            {
                return(Array.Empty <TypeIdentity>());
            }

            ModuleReference[] references = modules.AsReferences();

            return(assembly.GetDisabledTypes(references));
        }
コード例 #3
0
 /// <summary>
 /// Returns a collection of <see cref="TypeIdentity"/>s representing all enabled Durian <see cref="Type"/>s for the calling <see cref="Assembly"/> that are part of any of the provided <paramref name="modules"/>.
 /// </summary>
 /// <param name="modules"><see cref="ModuleContainer"/> that provides a collection of Durian modules to pick the <see cref="TypeIdentity"/>s from.</param>
 /// <exception cref="ArgumentNullException"><paramref name="modules"/> is <see langword="null"/>.</exception>
 public static IEnumerable <TypeIdentity> GetEnabledTypes(ModuleContainer modules)
 {
     return(Assembly.GetCallingAssembly().GetEnabledTypes(modules));
 }