Show / Hide Table of Contents

Class StringUnpacker

AssemblyUnpacker<T> that allows extracting text files embedded in an assembly as a string.

Inheritance
object
AssemblyUnpacker<string>
StringUnpacker
Implements
IUnpacker<string>
IAsyncUnpacker<string>
Inherited Members
AssemblyUnpacker<string>.UnpackStream(string)
AssemblyUnpacker<string>.UnpackStream(string, ICompressorGetter)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Resources
Assembly: MCART.dll
Syntax
public class StringUnpacker : AssemblyUnpacker<string>, IUnpacker<string>, IAsyncUnpacker<string>

Constructors

| Edit this page View Source

StringUnpacker(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 Source

GetStream(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
AssemblyUnpacker<string>.TryUnpack(string, out string)
| Edit this page View Source

TryUnpack(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
AssemblyUnpacker<string>.TryUnpack(string, ICompressorGetter, out string)
| Edit this page View Source

TryUnpackAsync(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.

| Edit this page View Source

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.

| Edit this page View Source

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
AssemblyUnpacker<string>.Unpack(string)
| Edit this page View Source

Unpack(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
AssemblyUnpacker<string>.Unpack(string, ICompressorGetter)
| Edit this page View Source

UnpackAsync(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.

| Edit this page View Source

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.

Implements

IUnpacker<T>
IAsyncUnpacker<T>

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX