// dnlib: See LICENSE.txt for more info using System; using System.Collections.Generic; using dnlib.PE; namespace dnlib.DotNet.MD { /// /// Reads .NET metadata /// public abstract class Metadata : IDisposable { /// /// true if the compressed (normal) metadata is used, false if the non-compressed /// (Edit N' Continue) metadata is used. This can be false even if the table stream /// is #~ but that's very uncommon. /// public abstract bool IsCompressed { get; } /// /// true if this is standalone Portable PDB metadata /// public abstract bool IsStandalonePortablePdb { get; } /// /// Gets the .NET header /// public abstract ImageCor20Header ImageCor20Header { get; } /// /// Gets the version found in the metadata header. The major version number is in the high 16 bits /// and the lower version number is in the low 16 bits. /// public abstract uint Version { get; } /// /// Gets the version string found in the metadata header /// public abstract string VersionString { get; } /// /// Gets the /// public abstract IPEImage PEImage { get; } /// /// Gets the metadata header /// public abstract MetadataHeader MetadataHeader { get; } /// /// Returns the #Strings stream or a default empty one if it's not present /// public abstract StringsStream StringsStream { get; } /// /// Returns the #US stream or a default empty one if it's not present /// public abstract USStream USStream { get; } /// /// Returns the #Blob stream or a default empty one if it's not present /// public abstract BlobStream BlobStream { get; } /// /// Returns the #GUID stream or a default empty one if it's not present /// public abstract GuidStream GuidStream { get; } /// /// Returns the #~ or #- tables stream /// public abstract TablesStream TablesStream { get; } /// /// Returns the #Pdb stream or null if it's not a standalone portable PDB file /// public abstract PdbStream PdbStream { get; } /// /// Gets all streams /// public abstract IList AllStreams { get; } /// /// Gets a list of all the valid TypeDef rids. It's usually every rid in the /// TypeDef table, but could be less if a type has been deleted. /// public abstract RidList GetTypeDefRidList(); /// /// Gets a list of all the valid ExportedType rids. It's usually every rid in the /// ExportedType table, but could be less if a type has been deleted. /// public abstract RidList GetExportedTypeRidList(); /// /// Gets the Field rid list /// /// TypeDef rid /// A new instance public abstract RidList GetFieldRidList(uint typeDefRid); /// /// Gets the Method rid list /// /// TypeDef rid /// A new instance public abstract RidList GetMethodRidList(uint typeDefRid); /// /// Gets the Param rid list /// /// Method rid /// A new instance public abstract RidList GetParamRidList(uint methodRid); /// /// Gets the Event rid list /// /// EventMap rid /// A new instance public abstract RidList GetEventRidList(uint eventMapRid); /// /// Gets the Property rid list /// /// PropertyMap rid /// A new instance public abstract RidList GetPropertyRidList(uint propertyMapRid); /// /// Finds all InterfaceImpl rids owned by /// /// Owner TypeDef rid /// A instance containing the valid InterfaceImpl rids public abstract RidList GetInterfaceImplRidList(uint typeDefRid); /// /// Finds all GenericParam rids owned by in table /// /// A TypeOrMethodDef table /// Owner rid /// A instance containing the valid GenericParam rids public abstract RidList GetGenericParamRidList(Table table, uint rid); /// /// Finds all GenericParamConstraint rids owned by /// /// Owner GenericParam rid /// A instance containing the valid GenericParamConstraint rids public abstract RidList GetGenericParamConstraintRidList(uint genericParamRid); /// /// Finds all CustomAttribute rids owned by in table /// /// A HasCustomAttribute table /// Owner rid /// A instance containing the valid CustomAttribute rids public abstract RidList GetCustomAttributeRidList(Table table, uint rid); /// /// Finds all DeclSecurity rids owned by in table /// /// A HasDeclSecurity table /// Owner rid /// A instance containing the valid DeclSecurity rids public abstract RidList GetDeclSecurityRidList(Table table, uint rid); /// /// Finds all MethodSemantics rids owned by in table /// /// A HasSemantic table /// Owner rid /// A instance containing the valid MethodSemantics rids public abstract RidList GetMethodSemanticsRidList(Table table, uint rid); /// /// Finds all MethodImpl rids owned by /// /// Owner TypeDef rid /// A instance containing the valid MethodImpl rids public abstract RidList GetMethodImplRidList(uint typeDefRid); /// /// Finds a ClassLayout rid /// /// Owner TypeDef rid /// The ClassLayout rid or 0 if is invalid /// or if it has no row in the ClassLayout table. public abstract uint GetClassLayoutRid(uint typeDefRid); /// /// Finds a FieldLayout rid /// /// Owner Field rid /// The FieldLayout rid or 0 if is invalid /// or if it has no row in the FieldLayout table. public abstract uint GetFieldLayoutRid(uint fieldRid); /// /// Finds a FieldMarshal rid /// /// A HasFieldMarshal table /// Owner rid /// The FieldMarshal rid or 0 if is invalid /// or if it has no row in the FieldMarshal table. public abstract uint GetFieldMarshalRid(Table table, uint rid); /// /// Finds a FieldRVA rid /// /// Owner Field rid /// The FieldRVA rid or 0 if is invalid /// or if it has no row in the FieldRVA table. public abstract uint GetFieldRVARid(uint fieldRid); /// /// Finds an ImplMap rid /// /// A MemberForwarded table /// Owner rid /// The ImplMap rid or 0 if is invalid /// or if it has no row in the ImplMap table. public abstract uint GetImplMapRid(Table table, uint rid); /// /// Finds a NestedClass rid /// /// Owner TypeDef rid /// The NestedClass rid or 0 if is invalid /// or if it has no row in the NestedClass table. public abstract uint GetNestedClassRid(uint typeDefRid); /// /// Finds an EventMap rid /// /// Owner TypeDef rid /// The EventMap rid or 0 if is invalid /// or if it has no row in the EventMap table. public abstract uint GetEventMapRid(uint typeDefRid); /// /// Finds a PropertyMap rid /// /// Owner TypeDef rid /// The PropertyMap rid or 0 if is invalid /// or if it has no row in the PropertyMap table. public abstract uint GetPropertyMapRid(uint typeDefRid); /// /// Finds a Constant rid /// /// A HasConstant table /// Owner rid /// The Constant rid or 0 if is invalid /// or if it has no row in the Constant table. public abstract uint GetConstantRid(Table table, uint rid); /// /// Returns the owner TypeDef rid /// /// A Field rid /// The owner TypeDef rid or 0 if is invalid /// or if it has no owner. public abstract uint GetOwnerTypeOfField(uint fieldRid); /// /// Returns the owner TypeDef rid /// /// A Method rid /// The owner TypeDef rid or 0 if is invalid /// or if it has no owner. public abstract uint GetOwnerTypeOfMethod(uint methodRid); /// /// Returns the owner TypeDef rid /// /// A Event rid /// The owner TypeDef rid or 0 if is invalid /// or if it has no owner. public abstract uint GetOwnerTypeOfEvent(uint eventRid); /// /// Returns the owner TypeDef rid /// /// A Property rid /// The owner TypeDef rid or 0 if is invalid /// or if it has no owner. public abstract uint GetOwnerTypeOfProperty(uint propertyRid); /// /// Returns the owner TypeOrMethodDef rid /// /// A GenericParam rid /// The owner TypeOrMethodDef rid or 0 if is /// invalid or if it has no owner. public abstract uint GetOwnerOfGenericParam(uint gpRid); /// /// Returns the owner GenericParam rid /// /// A GenericParamConstraint rid /// The owner GenericParam rid or 0 if is /// invalid or if it has no owner. public abstract uint GetOwnerOfGenericParamConstraint(uint gpcRid); /// /// Returns the owner Method rid /// /// A Param rid /// The owner Method rid or 0 if is invalid /// or if it has no owner. public abstract uint GetOwnerOfParam(uint paramRid); /// /// Gets a list of all nested classes owned by /// /// A TypeDef rid /// A new instance public abstract RidList GetNestedClassRidList(uint typeDefRid); /// /// Gets a list of all non-nested classes. A type is a non-nested type if /// returns an empty list. /// /// A new instance public abstract RidList GetNonNestedClassRidList(); /// /// Finds all LocalScope rids owned by /// /// Owner Method rid /// A instance containing the valid LocalScope rids public abstract RidList GetLocalScopeRidList(uint methodRid); /// /// Finds all LocalVariable rids owned by /// /// Owner LocalScope rid /// A instance containing the valid LocalVariable rids public abstract RidList GetLocalVariableRidList(uint localScopeRid); /// /// Finds all LocalConstant rids owned by /// /// Owner LocalScope rid /// A instance containing the valid LocalConstant rids public abstract RidList GetLocalConstantRidList(uint localScopeRid); /// /// Gets the StateMachineMethod rid or 0 if it's not a state machine method /// /// Owner Method rid /// public abstract uint GetStateMachineMethodRid(uint methodRid); /// /// Finds all CustomDebugInformation rids owned by in table /// /// A HasCustomDebugInformation table /// Owner rid /// A instance containing the valid CustomDebugInformation rids public abstract RidList GetCustomDebugInformationRidList(Table table, uint rid); /// /// Disposes of this instance /// public abstract void Dispose(); } }