Class ResourceFileProvider
Provides access to embedded resources to a FileModule.
Implements
Inherited Members
Namespace: EmbedIO.Files
Syntax
public class ResourceFileProvider : IFileProvider
Constructors
ResourceFileProvider(Assembly, String)
Initializes a new instance of the ResourceFileProvider class.
Declaration
public ResourceFileProvider(Assembly assembly, string pathPrefix)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly where served files are contained as embedded resources. |
String | pathPrefix | A string to prepend to provider-specific paths
to form the name of a manifest resource in |
Properties
Assembly
Gets the assembly where served files are contained as embedded resources.
Declaration
public Assembly Assembly { get; }
Property Value
Type | Description |
---|---|
Assembly |
IsImmutable
Gets a value indicating whether the files and directories provided by this instance will never change.
Declaration
public bool IsImmutable { get; }
Property Value
Type | Description |
---|---|
Boolean |
PathPrefix
Gets a string that is prepended to provider-specific paths to form the name of a manifest resource in Assembly.
Declaration
public string PathPrefix { get; }
Property Value
Type | Description |
---|---|
String |
Methods
GetDirectoryEntries(String, IMimeTypeProvider)
Returns an enumeration of the entries of a directory.
Declaration
public IEnumerable<MappedResourceInfo> GetDirectoryEntries(string providerPath, IMimeTypeProvider mimeTypeProvider)
Parameters
Type | Name | Description |
---|---|---|
String | providerPath | The provider-specific path for the directory. |
IMimeTypeProvider | mimeTypeProvider | An IMimeTypeProvider interface to use for determining the MIME type of files. |
Returns
Type | Description |
---|---|
IEnumerable<MappedResourceInfo> | An enumeration of MappedResourceInfo objects identifying the entries
in the directory identified by |
MapUrlPath(String, IMimeTypeProvider)
Maps a URL path to a provider-specific path.
Declaration
public MappedResourceInfo MapUrlPath(string path, IMimeTypeProvider mimeTypeProvider)
Parameters
Type | Name | Description |
---|---|---|
String | path | The URL path. |
IMimeTypeProvider | mimeTypeProvider | An IMimeTypeProvider interface to use for determining the MIME type of a file. |
Returns
Type | Description |
---|---|
MappedResourceInfo | A provider-specific path identifying a file or directory,
or null if this instance cannot provide a resource associated
to |
OpenFile(String)
Opens a file for reading.
Declaration
public Stream OpenFile(string providerPath)
Parameters
Type | Name | Description |
---|---|---|
String | providerPath | The provider-specific path for the file. |
Returns
Type | Description |
---|---|
Stream | A readable |
Start(CancellationToken)
Signals a file provider that the web server is starting.
Declaration
public void Start(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A |
Events
ResourceChanged
Occurs when a file or directory provided by this instance is modified or removed.
The event's parameter is the provider-specific path of the resource that changed.
Declaration
public event Action<string>? ResourceChanged
Event Type
Type | Description |
---|---|
Nullable<Action<String>> |