Class ResourceDirectory
- Namespace
 - AsmResolver.PE.Win32Resources
 
- Assembly
 - AsmResolver.PE.dll
 
Represents a single directory containing Win32 resources of a PE image.
public class ResourceDirectory : IResourceEntry, IOwnedCollectionElement<ResourceDirectory>
  - Inheritance
 - 
      
      ResourceDirectory
 
- Implements
 
- Derived
 
- Inherited Members
 
Constructors
ResourceDirectory()
Initializes a new resource directory entry.
protected ResourceDirectory()
  ResourceDirectory(ResourceType)
Creates a new resource directory defined by its resource type.
public ResourceDirectory(ResourceType type)
  Parameters
typeResourceTypeThe type.
ResourceDirectory(string)
Creates a new named resource directory.
public ResourceDirectory(string name)
  Parameters
namestringThe name of the directory.
ResourceDirectory(uint)
Creates a new resource directory defined by a numeric identifier.
public ResourceDirectory(uint id)
  Parameters
iduintThe identifier.
Properties
Characteristics
Gets or sets the flags of the directory.
public uint Characteristics { get; set; }
  Property Value
Remarks
This field is reserved and is usually set to zero.
Entries
Gets a collection of entries that are stored in the directory.
public IList<IResourceEntry> Entries { get; }
  Property Value
Id
Gets or sets the ID of the entry.
public uint Id { get; set; }
  Property Value
MajorVersion
Gets or sets the major version number of the directory.
public ushort MajorVersion { get; set; }
  Property Value
MinorVersion
Gets or sets the minor version number of the directory.
public ushort MinorVersion { get; set; }
  Property Value
Name
Gets or sets the name of the entry.
public string? Name { get; set; }
  Property Value
ParentDirectory
Gets the parent directory the entry is stored in.
public ResourceDirectory? ParentDirectory { get; }
  Property Value
TimeDateStamp
Gets or sets the time that the resource data was created by the compiler.
public uint TimeDateStamp { get; set; }
  Property Value
Type
Gets the type of resources stored in the directory.
public ResourceType Type { get; set; }
  Property Value
Methods
GetData(uint)
Looks up a data entry in the directory by its unique identifier.
public ResourceData GetData(uint id)
  Parameters
iduintThe id of the data entry to lookup.
Returns
- ResourceData
 The data entry.
Exceptions
- KeyNotFoundException
 Occurs when no data entry with the provided identifier was found.
GetDirectory(ResourceType)
Looks up an directory by its resource type.
public ResourceDirectory GetDirectory(ResourceType type)
  Parameters
typeResourceTypeThe type of resources to lookup.
Returns
- ResourceDirectory
 The directory.
Exceptions
- KeyNotFoundException
 Occurs when no directory with the provided identifier was found.
GetDirectory(uint)
Looks up an directory by its unique identifier.
public ResourceDirectory GetDirectory(uint id)
  Parameters
iduintThe identifier of the directory to lookup.
Returns
- ResourceDirectory
 The directory.
Exceptions
- KeyNotFoundException
 Occurs when no directory with the provided identifier was found.
GetEntries()
Obtains the list of entries in the directory.
protected virtual IList<IResourceEntry> GetEntries()
  Returns
- IList<IResourceEntry>
 The list of entries.
Remarks
This method is called upon initialization of the Entries property.
GetEntry(uint)
Looks up an entry in the directory by its unique identifier.
public IResourceEntry GetEntry(uint id)
  Parameters
iduintThe identifier of the entry to lookup.
Returns
- IResourceEntry
 The entry.
Exceptions
- KeyNotFoundException
 Occurs when no entry with the provided identifier was found.
InsertOrReplaceEntry(IResourceEntry)
Replaces an existing entry with the same ID with the provided entry, or inserts the new entry into the directory.
public void InsertOrReplaceEntry(IResourceEntry entry)
  Parameters
entryIResourceEntryThe entry to store in the directory.
RemoveEntry(ResourceType)
Removes a directory in the directory by its resource type.
public bool RemoveEntry(ResourceType type)
  Parameters
typeResourceTypeThe type of resources to remove.
Returns
- bool
 trueif the directory was found and removed,falseotherwise.
RemoveEntry(uint)
Removes an entry in the directory by its unique identifier.
public bool RemoveEntry(uint id)
  Parameters
iduintThe identifier of the entry to remove.
Returns
- bool
 trueif the data entry was found and removed,falseotherwise.
ToString()
Returns a string that represents the current object.
public override string ToString()
  Returns
- string
 A string that represents the current object.
TryGetData(uint, out ResourceData?)
Attempts to looks up a data entry in the directory by its unique identifier.
public bool TryGetData(uint id, out ResourceData? data)
  Parameters
iduintThe identifier of the data entry to lookup.
dataResourceDataThe found data entry, or
nullif none was found.
Returns
- bool
 trueif the data entry was found,falseotherwise.
TryGetDirectory(ResourceType, out ResourceDirectory?)
Attempts to looks up a directory by its resource type.
public bool TryGetDirectory(ResourceType type, out ResourceDirectory? directory)
  Parameters
typeResourceTypeThe type of resources to lookup.
directoryResourceDirectoryThe found directory, or
nullif none was found.
Returns
- bool
 trueif the directory was found,falseotherwise.
TryGetDirectory(uint, out ResourceDirectory?)
Attempts to looks up a directory by its unique identifier.
public bool TryGetDirectory(uint id, out ResourceDirectory? directory)
  Parameters
iduintThe identifier of the directory to lookup.
directoryResourceDirectoryThe found directory, or
nullif none was found.
Returns
- bool
 trueif the directory was found,falseotherwise.
TryGetEntry(uint, out IResourceEntry?)
Attempts to looks up an entry in the directory by its unique identifier.
public bool TryGetEntry(uint id, out IResourceEntry? entry)
  Parameters
iduintThe identifier of the entry to lookup.
entryIResourceEntryThe found entry, or
nullif none was found.
Returns
- bool
 trueif the entry was found,falseotherwise.