src/packages/EmbedIO/WebModuleContainerExtensions-Files.cs
/// <summary>
/// Creates an instance of <see cref="ZipFileProvider"/> using a file-system path, uses it to initialize
/// a <seealso cref="FileModule"/>, and adds the latter to a module container,
/// giving it the specified <paramref name="name"/> if not <see langword="null"/>.
/// </summary>
/// <typeparam name="TContainer">The type of the module container.</typeparam>
/// <param name="this">The <typeparamref name="TContainer"/> on which this method is called.</param>
/// <param name="name">The name.</param>
/// <param name="baseRoute">The base route of the module.</param>
/// <param name="zipFilePath">The zip file-system path.</param>
/// <param name="configure">A callback used to configure the module.</param>
/// <returns><paramref name="this"/> with a <see cref="FileModule"/> added.</returns>
/// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
/// <seealso cref="FileModule"/>
/// <seealso cref="ZipFileProvider"/>
/// <seealso cref="IWebModuleContainer.Modules"/>
/// <seealso cref="IComponentCollection{T}.Add"/>
Creates an instance of  using a file-system path, uses it to initialize
a , and adds the latter to a module container,
giving it the specified  if not .
Creates an instance of using a file - system path uses it to initialize a and adds the latter to a module container giving it the specified if not .
public static TContainer WithZipFile<TContainer>(
            this TContainer @this,
            string? name,
            string baseRoute,
            string zipFilePath,
            Action<FileModule>? configure = null)
            where TContainer : class, IWebModuleContainer
        {
#pragma warning disable CA2000 
            var provider = new ZipFileProvider(zipFilePath);
#pragma warning restore CA2000
            try
            {
                var module = new FileModule(baseRoute, provider);
                return WithModule(@this, name, module, configure);
            }
            catch
            {
                provider.Dispose();
                throw;
            }
        }
public static TContainer WithZipFile < TContainer > ( this TContainer @this , string ? name , string baseRoute , string zipFilePath , Action < FileModule > ? configure = null ) where TContainer : class , IWebModuleContainer { pragma warning disable CA2000 var provider = new ZipFileProvider ( zipFilePath ) ; pragma warning restore CA2000 try { var module = new FileModule ( baseRoute , provider ) ; return WithModule ( @this , name , module , configure ) ; } catch { provider . Dispose ( ) ; throw ; } }
Creates an instance of  using a file-system path, uses it to initialize
a , and adds the latter to a module container,
giving it the specified  if not .
Creates an instance of using a file - system path uses it to initialize a and adds the latter to a module container giving it the specified if not .
// Call Dispose on disposable - Ownership of provider is transferred to module
with a  added.
with a added .
None
TContainer
this
name
string?
None
baseRoute
string
The base route of the module.
The base route of the module .
zipFilePath
string
The zip file-system path.
The zip file - system path .
configure
Action<FileModule>?
A callback used to configure the module.
A callback used to configure the module .
this
The  on which this method is called.
The on which this method is called .
typeparam
The type of the module container.
The type of the module container .
seealso
None
seealso
None
seealso
None
seealso
None