Class ManifestResource
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents a single manifest resource file either embedded into the .NET assembly, or put into a separate file. In this case, it contains also a reference to the file the resource is located in.
public class ManifestResource : MetadataMember, INameProvider, IHasCustomAttribute, IMetadataMember, IOwnedCollectionElement<ModuleDefinition>
- Inheritance
-
ManifestResource
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ManifestResource(MetadataToken)
Initializes the ManifestResource with a metadata token.
protected ManifestResource(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token.
ManifestResource(Utf8String?, ManifestResourceAttributes, IImplementation?, uint)
Creates a new external manifest resource.
public ManifestResource(Utf8String? name, ManifestResourceAttributes attributes, IImplementation? implementation, uint offset)
Parameters
name
Utf8StringThe name of the resource
attributes
ManifestResourceAttributesThe attributes of the resource.
implementation
IImplementationThe location of the resource data.
offset
uintThe offset within the file referenced by
implementation
where the data starts.
ManifestResource(Utf8String?, ManifestResourceAttributes, ISegment?)
Creates a new embedded manifest resource.
public ManifestResource(Utf8String? name, ManifestResourceAttributes attributes, ISegment? data)
Parameters
name
Utf8StringThe name of the repository.
attributes
ManifestResourceAttributesThe attributes of the resource.
data
ISegmentThe embedded resource data.
Properties
Attributes
Gets or sets the attributes associated with this resource.
public ManifestResourceAttributes Attributes { get; set; }
Property Value
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
Property Value
EmbeddedDataSegment
When this resource is embedded into the current module, gets or sets the embedded resource data.
public ISegment? EmbeddedDataSegment { get; set; }
Property Value
Implementation
Gets or sets the implementation indicating the file containing the resource data.
public IImplementation? Implementation { get; set; }
Property Value
IsEmbedded
Gets a value indicating whether the resource is embedded into the current module.
public bool IsEmbedded { get; }
Property Value
IsPrivate
Gets or sets a value indicating whether the resource is private to the .NET module.
public bool IsPrivate { get; set; }
Property Value
IsPublic
Gets or sets a value indicating whether the resource is public and exported by the .NET module.
public bool IsPublic { get; set; }
Property Value
Module
Gets the module that this manifest resource reference is stored in.
public ModuleDefinition? Module { get; }
Property Value
Name
Gets or sets the name of the manifest resource.
public Utf8String? Name { get; set; }
Property Value
Remarks
This property corresponds to the Name column in the manifest resource table.
Offset
Depending on the value of Implementation, gets or sets the (relative) offset the resource data starts at.
public uint Offset { get; set; }
Property Value
Methods
GetCustomAttributes()
Obtains the list of custom attributes assigned to the member.
protected virtual IList<CustomAttribute> GetCustomAttributes()
Returns
- IList<CustomAttribute>
The attributes
Remarks
This method is called upon initialization of the CustomAttributes property.
GetData()
Gets the data stored in the manifest resource.
public byte[]? GetData()
Returns
- byte[]
The data, or
null
if no data was stored or if the external resource was not found.
GetEmbeddedDataSegment()
When the resource is embedded, obtains the contents of the manifest resource.
protected virtual ISegment? GetEmbeddedDataSegment()
Returns
- ISegment
The data, or
null
if the resource is not embedded.
GetImplementation()
Obtains the implementation of this resource.
protected virtual IImplementation? GetImplementation()
Returns
- IImplementation
The implementation.
Remarks
This method is called upon initialization of the Implementation property.
GetName()
Obtains the name of the manifest resource.
protected virtual Utf8String? GetName()
Returns
- Utf8String
The name.
Remarks
This method is called upon initialization of the Name property.
GetReader()
Gets the reader of stored data in the manifest resource.
[Obsolete("Use TryGetReader instead.")]
public BinaryStreamReader? GetReader()
Returns
- BinaryStreamReader?
The reader, or
null
if no data was stored or if the external resource was not found.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryGetReader(out BinaryStreamReader)
Gets the reader of stored data in the manifest resource.
public bool TryGetReader(out BinaryStreamReader reader)
Parameters
reader
BinaryStreamReader