Esempio n. 1
0
        /// <summary>
        ///     Registers a <see cref="ContentSource"/> for content from embedded resources in the
        ///     executing assembly.
        /// </summary>
        /// <param name="builder">The <see cref="ContentSourceBuilder"/> instance.</param>
        /// <param name="options">Options for registering the content source.</param>
        /// <returns>An instance of <see cref="ContentBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if the <paramref name="builder"/> or <paramref name="options"/> parameters are
        ///     <c>null</c>.
        /// </exception>
        public static ContentBuilder ResourcesInExecutingAssembly(this ContentSourceBuilder builder,
                                                                  EmbeddedResourceContentSourceOptions options)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(builder.Source(new EmbeddedResourceContentSource(
                                      new[] { Assembly.GetCallingAssembly() }, options)));
        }
Esempio n. 2
0
        /// <summary>
        ///     Registers a <see cref="ContentSource"/> for content from embedded resources in the
        ///     specified <paramref name="assemblies"/>.
        /// </summary>
        /// <param name="builder">The <see cref="ContentSourceBuilder"/> instance.</param>
        /// <param name="assemblies">The assembly to load resources from.</param>
        /// <param name="options">Options for registering the content source.</param>
        /// <returns>An instance of <see cref="ContentBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if the <paramref name="builder"/>, <paramref name="assemblies"/>
        ///     or <paramref name="options"/> parameters are <c>null</c>.
        /// </exception>
        public static ContentBuilder ResourcesIn(this ContentSourceBuilder builder, IEnumerable <Assembly> assemblies,
                                                 EmbeddedResourceContentSourceOptions options)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (assemblies is null)
            {
                throw new ArgumentNullException(nameof(assemblies));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(builder.Source(new EmbeddedResourceContentSource(assemblies, options)));
        }
Esempio n. 3
0
        /// <summary>
        ///     Registers a <see cref="ContentSource"/> for content from embedded resources in the
        ///     specified <paramref name="assembly"/>.
        /// </summary>
        /// <param name="builder">The <see cref="ContentSourceBuilder"/> instance.</param>
        /// <param name="assembly">The assembly to load resources from.</param>
        /// <param name="options">Options for registering the content source.</param>
        /// <returns>An instance of <see cref="ContentBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if the <paramref name="builder"/>, <paramref name="assembly"/> or
        ///     <paramref name="options"/> parameters are <c>null</c>.
        /// </exception>
        public static ContentBuilder ResourcesIn(this ContentSourceBuilder builder, Assembly assembly,
                                                 EmbeddedResourceContentSourceOptions options)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (assembly is null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(builder.Source(new EmbeddedResourceContentSource(new[] { assembly }, options)));
        }