Class AssemblyUnpacker<T>
Base class for defining an IUnpacker<T> that extracts embedded resources from an Assembly.
Inheritance
Implements
Inherited Members
Namespace: TheXDS.MCART.Resources
Assembly: MCART.dll
Syntax
public abstract class AssemblyUnpacker<T> : IUnpacker<T>
Type Parameters
Name | Description |
---|---|
T | Type of resources to extract. |
Constructors
| Edit this page View SourceAssemblyUnpacker(Assembly, string)
Base class for defining an IUnpacker<T> that extracts embedded resources from an Assembly.
Declaration
protected AssemblyUnpacker(Assembly assembly, string path)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | Assembly from which embedded resources will be extracted. |
string | path | Path (in namespace format) where the embedded resources will be located. |
Methods
| Edit this page View SourceTryUnpack(string, ICompressorGetter, out T)
Attempts to get an identifiable resource.
Declaration
public virtual bool TryUnpack(string id, ICompressorGetter compressor, out T result)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
ICompressorGetter | compressor | ICompressorGetter to use to extract the resource. |
T | result | Output parameter. A resource of type
|
Returns
Type | Description |
---|---|
bool | true if the resource was successfully extracted, false otherwise. |
TryUnpack(string, out T)
Attempts to get an identifiable resource.
Declaration
public virtual bool TryUnpack(string id, out T result)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
T | result | Output parameter. A resource of type
|
Returns
Type | Description |
---|---|
bool | true if the resource was successfully extracted, false otherwise. |
Unpack(string)
Gets an identifiable resource.
Declaration
public abstract T Unpack(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
Returns
Type | Description |
---|---|
T | A resource of type |
Unpack(string, ICompressorGetter)
Extracts a compressed resource using the specified compressor.
Declaration
public abstract T Unpack(string id, ICompressorGetter compressor)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
ICompressorGetter | compressor | ICompressorGetter to use to extract the resource. |
Returns
Type | Description |
---|---|
T | An uncompressed resource of type |
UnpackStream(string)
Gets a Stream from which to read an embedded resource.
Declaration
protected Stream? UnpackStream(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the embedded resource. |
Returns
Type | Description |
---|---|
Stream | A Stream from which to read an embedded resource. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
UnpackStream(string, ICompressorGetter?)
Gets a Stream from which to extract a compressed embedded resource.
Declaration
protected Stream UnpackStream(string id, ICompressorGetter? compressor)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the embedded resource. |
ICompressorGetter | compressor | ICompressorGetter to use to extract the resource, or null to not use a decompression extractor. |
Returns
Type | Description |
---|---|
Stream | A Stream from which to read an uncompressed embedded resource. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
MissingResourceException | Thrown if an embedded resource with the specified ID is not found in the path defined for this resource extractor. |