Table of Contents

Class DotNetResourcesDirectoryBuffer

Namespace
AsmResolver.DotNet.Builder.Resources
Assembly
AsmResolver.DotNet.dll

Provides a mutable buffer for building up a .NET resources directory, containing all data of all resources stored in a .NET module.

public class DotNetResourcesDirectoryBuffer
Inheritance
DotNetResourcesDirectoryBuffer
Inherited Members

Constructors

DotNetResourcesDirectoryBuffer()

Creates a new instance of the DotNetResourcesDirectoryBuffer class.

public DotNetResourcesDirectoryBuffer()

Properties

Size

Gets the size of the buffer.

public uint Size { get; }

Property Value

uint

Methods

AppendLengthPrefixedData(byte[])

Appends raw data to the stream, prepending the data with a length.

public uint AppendLengthPrefixedData(byte[] data)

Parameters

data byte[]

The data to append.

Returns

uint

The index to the start of the prefixed data.

Remarks

This method does not index the resource data. Calling AppendRawData(byte[]), AppendLengthPrefixedData(byte[]) or GetResourceDataOffset(byte[]?) on the same data will append the data a second time.

AppendRawData(byte[])

Appends raw data to the stream.

public uint AppendRawData(byte[] data)

Parameters

data byte[]

The data to append.

Returns

uint

The index to the start of the data.

Remarks

This method does not index the resource data. Calling AppendRawData(byte[]), AppendLengthPrefixedData(byte[]) or GetResourceDataOffset(byte[]?) on the same data will append the data a second time.

CreateDirectory()

Serialises the .NET resources directory buffer to a data directory.

public DotNetResourcesDirectory CreateDirectory()

Returns

DotNetResourcesDirectory

The metadata stream.

GetResourceDataOffset(byte[]?)

Gets the index to the provided resource data. If the blob is not present in the buffer, it will be appended to the end of the stream.

public uint GetResourceDataOffset(byte[]? data)

Parameters

data byte[]

The resource data to lookup or add.

Returns

uint

The offset of the resource data.