Class StringUnpacker
AssemblyUnpacker<T> that allows extracting text files embedded in an assembly as a string.
Inherited Members
Namespace: TheXDS.MCART.Resources
Assembly: MCART.dll
Syntax
public class StringUnpacker : AssemblyUnpacker<string>, IUnpacker<string>, IAsyncUnpacker<string>
Constructors
| Edit this page View SourceStringUnpacker(Assembly, string)
AssemblyUnpacker<T> that allows extracting text files embedded in an assembly as a string.
Declaration
public StringUnpacker(Assembly assembly, string path)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The Assembly from which the embedded resources will be extracted. |
string | path | The path (in namespace format) where the embedded resources will be located. |
Methods
| Edit this page View SourceGetStream(string)
Gets a StreamReader from the specified
id
.
Declaration
protected StreamReader GetStream(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the Stream of the embedded resource to retrieve. |
Returns
Type | Description |
---|---|
StreamReader | A StreamReader that allows reading the underlying sequence of the embedded resource. |
GetStream(string, ICompressorGetter)
Gets a StreamReader from the specified
id
and compressor
.
Declaration
protected StreamReader GetStream(string id, ICompressorGetter compressor)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the Stream of the embedded resource to retrieve. |
ICompressorGetter | compressor | The specific compressor to use for reading the resource. |
Returns
Type | Description |
---|---|
StreamReader | A StreamReader that allows reading the underlying sequence of the embedded resource. |
TryGetStream(string, out StreamReader)
Attempts to get a StreamReader from the
specified id
.
Declaration
protected bool TryGetStream(string id, out StreamReader reader)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the Stream of the embedded resource to retrieve. |
StreamReader | reader | Output parameter. A StreamReader that allows reading the underlying sequence of the embedded resource. |
Returns
Type | Description |
---|---|
bool | true if a StreamReader was successfully created for the resource, false otherwise. |
TryGetStream(string, ICompressorGetter, out StreamReader)
Attempts to get a StreamReader from the
specified id
and compressor
.
Declaration
protected bool TryGetStream(string id, ICompressorGetter compressor, out StreamReader reader)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the Stream of the embedded resource to retrieve. |
ICompressorGetter | compressor | The specific compressor to use for reading the resource. |
StreamReader | reader | Output parameter. A StreamReader that allows reading the underlying sequence of the embedded resource. |
Returns
Type | Description |
---|---|
bool | true if a StreamReader was successfully created for the resource, false otherwise. |
TryUnpack(string, out string)
Attempts to get an identifiable resource.
Declaration
public override bool TryUnpack(string id, out string data)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
string | data |
Returns
Type | Description |
---|---|
bool | true if the resource was successfully extracted, false otherwise. |
Overrides
| Edit this page View SourceTryUnpack(string, ICompressorGetter, out string)
Attempts to get an identifiable resource.
Declaration
public override bool TryUnpack(string id, ICompressorGetter compressor, out string data)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
ICompressorGetter | compressor | ICompressorGetter to use to extract the resource. |
string | data |
Returns
Type | Description |
---|---|
bool | true if the resource was successfully extracted, false otherwise. |
Overrides
| Edit this page View SourceTryUnpackAsync(string)
Tries to unpack a resource asyncronously, and returns a value that indicates either success or failure to unpack the requested resource.
Declaration
public Task<UnpackResult<string>> TryUnpackAsync(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | Resource id to be unpacked. |
Returns
Type | Description |
---|---|
Task<UnpackResult<string>> | A new UnpackResult<T> that indicates either success or failure to unpack the requested resource, as well as a reference to the unpacked resource if the extraction was successful. |
TryUnpackAsync(string, ICompressorGetter)
Tries to unpack a resource asyncronously, and returns a value that indicates either success or failure to unpack the requested resource.
Declaration
public Task<UnpackResult<string>> TryUnpackAsync(string id, ICompressorGetter compressor)
Parameters
Type | Name | Description |
---|---|---|
string | id | Resource id to be unpacked. |
ICompressorGetter | compressor | Compressor getter instance to use. |
Returns
Type | Description |
---|---|
Task<UnpackResult<string>> | A new UnpackResult<T> that indicates either success or failure to unpack the requested resource, as well as a reference to the unpacked resource if the extraction was successful. |
Unpack(string)
Gets an identifiable resource.
Declaration
public override string Unpack(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
Returns
Type | Description |
---|---|
string | A resource of type string. |
Overrides
| Edit this page View SourceUnpack(string, ICompressorGetter)
Extracts a compressed resource using the specified compressor.
Declaration
public override string 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 |
---|---|
string | An uncompressed resource of type string. |
Overrides
| Edit this page View SourceUnpackAsync(string)
Gets an identifiable resource asynchronously.
Declaration
public Task<string> UnpackAsync(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
Returns
Type | Description |
---|---|
Task<string> | A resource of type string. |
UnpackAsync(string, ICompressorGetter)
Extracts a compressed resource using the compressor with the specified identifier asynchronously.
Declaration
public Task<string> UnpackAsync(string id, ICompressorGetter compressor)
Parameters
Type | Name | Description |
---|---|---|
string | id | Identifier of the resource. |
ICompressorGetter | compressor | ICompressorGetter to use for extracting the resource. |
Returns
Type | Description |
---|---|
Task<string> | An uncompressed resource of type string. |