Table of Contents

Class ResourceManagement

Namespace
Embedix.Core.dnlib.Resources
Assembly
Embedix.Core.dll

Adds, replaces and reads embedded resources of an assembly's module.

public class ResourceManagement
Inheritance
ResourceManagement
Inherited Members

Constructors

ResourceManagement(AssemblyContext)

Initializes a new instance of the ResourceManagement class.

public ResourceManagement(AssemblyContext context)

Parameters

context AssemblyContext

The context whose module resources are managed.

Methods

Add(string)

Adds a public embedded resource from a file, named after the file name.

public void Add(string path)

Parameters

path string

Path of the file to embed.

Add(string, byte[])

Adds a public embedded resource from a byte array.

public void Add(string name, byte[] bytes)

Parameters

name string

The resource name.

bytes byte[]

The resource data.

GetByteResource(string)

Gets the data of an embedded resource as a byte array.

public byte[] GetByteResource(string name)

Parameters

name string

The resource name.

Returns

byte[]

The resource bytes, or null if no resource matches.

Exceptions

InvalidCastException

A resource with that name exists but is not an embedded resource.

GetStreamResource(string)

Gets the data of an embedded resource as a stream.

public MemoryStream GetStreamResource(string name)

Parameters

name string

The resource name.

Returns

MemoryStream

A new MemoryStream positioned at the start, or null if no resource matches.

Exceptions

InvalidCastException

A resource with that name exists but is not an embedded resource.

Replace(string)

Replaces the resource named after the file name with the file contents (the new resource is appended at the end of the list); does nothing if no such resource exists.

public void Replace(string path)

Parameters

path string

Path of the file providing the new data.

Replace(string, byte[])

Replaces the first resource with the given name by removing it and appending a new one at the end of the resource list; does nothing if none exists.

public void Replace(string name, byte[] bytes)

Parameters

name string

The name of the resource to replace.

bytes byte[]

The new resource data.