Example #1
0
 /// <summary>
 /// Initializes the <see cref="ImplementationMap"/> with a metadata token.
 /// </summary>
 /// <param name="token">The token of the member.</param>
 protected ImplementationMap(MetadataToken token)
     : base(token)
 {
     _name            = new LazyVariable <string>(GetName);
     _scope           = new LazyVariable <ModuleReference>(GetScope);
     _memberForwarded = new LazyVariable <IMemberForwarded>(GetMemberForwarded);
 }
Example #2
0
 /// <summary>
 /// Initializes an exported type with a metadata token.
 /// </summary>
 /// <param name="token">The metadata token.</param>
 protected ExportedType(MetadataToken token)
     : base(token)
 {
     _name           = new LazyVariable <string>(GetName);
     _namespace      = new LazyVariable <string>(GetNamespace);
     _implementation = new LazyVariable <IImplementation>(GetImplementation);
 }
Example #3
0
 /// <summary>
 /// Initializes a new empty type reference.
 /// </summary>
 /// <param name="token">The token of the type reference.</param>
 protected TypeReference(MetadataToken token)
     : base(token)
 {
     _name      = new LazyVariable <string>(GetName);
     _namespace = new LazyVariable <string>(GetNamespace);
     _scope     = new LazyVariable <IResolutionScope>(GetScope);
 }
Example #4
0
 /// <summary>
 /// Initializes an empty custom attribute.
 /// </summary>
 /// <param name="token">The token of the custom attribute.</param>
 protected CustomAttribute(MetadataToken token)
     : base(token)
 {
     _parent      = new LazyVariable <IHasCustomAttribute>(GetParent);
     _constructor = new LazyVariable <ICustomAttributeType>(GetConstructor);
     _signature   = new LazyVariable <CustomAttributeSignature>(GetSignature);
 }
Example #5
0
 /// <summary>
 /// Initializes the <see cref="ManifestResource"/> with a metadata token.
 /// </summary>
 /// <param name="token">The metadata token.</param>
 protected ManifestResource(MetadataToken token)
     : base(token)
 {
     _name           = new LazyVariable <string>(GetName);
     _implementation = new LazyVariable <IImplementation>(GetImplementation);
     _embeddedData   = new LazyVariable <ISegment>(GetEmbeddedDataSegment);
 }
Example #6
0
 /// <summary>
 /// Initializes a new member reference.
 /// </summary>
 /// <param name="token">The metadata token of the reference.</param>
 protected MemberReference(MetadataToken token)
     : base(token)
 {
     _parent    = new LazyVariable <IMemberRefParent>(GetParent);
     _name      = new LazyVariable <string>(GetName);
     _signature = new LazyVariable <CallingConventionSignature>(GetSignature);
 }
Example #7
0
 /// <summary>
 /// Initializes a new PE image.
 /// </summary>
 public PEImage()
 {
     _exports         = new LazyVariable <IExportDirectory>(GetExports);
     _resources       = new LazyVariable <IResourceDirectory>(GetResources);
     _exceptions      = new LazyVariable <IExceptionDirectory>(GetExceptions);
     _dotNetDirectory = new LazyVariable <IDotNetDirectory>(GetDotNetDirectory);
 }
Example #8
0
 /// <summary>
 /// Initializes a new property definition.
 /// </summary>
 /// <param name="token">The token of the property.</param>
 protected EventDefinition(MetadataToken token)
     : base(token)
 {
     _name          = new LazyVariable <string>(GetName);
     _eventType     = new LazyVariable <ITypeDefOrRef>(GetEventType);
     _declaringType = new LazyVariable <TypeDefinition>(GetDeclaringType);
 }
Example #9
0
 /// <summary>
 /// Creates a new portable executable file.
 /// </summary>
 /// <param name="dosHeader">The DOS header to add.</param>
 /// <param name="fileHeader">The COFF header to add.</param>
 /// <param name="optionalHeader">The optional header to add.</param>
 public PEFile(DosHeader dosHeader, FileHeader fileHeader, OptionalHeader optionalHeader)
 {
     DosHeader         = dosHeader ?? throw new ArgumentNullException(nameof(dosHeader));
     FileHeader        = fileHeader ?? throw new ArgumentNullException(nameof(fileHeader));
     OptionalHeader    = optionalHeader ?? throw new ArgumentNullException(nameof(optionalHeader));
     _extraSectionData = new LazyVariable <ISegment>(GetExtraSectionData);
     MappingMode       = PEMappingMode.Unmapped;
 }
 /// <summary>
 /// Initializes a new parameter definition.
 /// </summary>
 /// <param name="token">The token of the parameter definition.</param>
 protected ParameterDefinition(MetadataToken token)
     : base(token)
 {
     _name              = new LazyVariable <string>(GetName);
     _method            = new LazyVariable <MethodDefinition>(GetMethod);
     _constant          = new LazyVariable <Constant>(GetConstant);
     _marshalDescriptor = new LazyVariable <MarshalDescriptor>(GetMarshalDescriptor);
 }
Example #11
0
 /// <summary>
 /// Initializes a new property definition.
 /// </summary>
 /// <param name="token">The token of the property.</param>
 protected PropertyDefinition(MetadataToken token)
     : base(token)
 {
     _name          = new LazyVariable <string>(GetName);
     _signature     = new LazyVariable <PropertySignature>(GetSignature);
     _declaringType = new LazyVariable <TypeDefinition>(GetDeclaringType);
     _constant      = new LazyVariable <Constant>(GetConstant);
 }
 /// <summary>
 /// Initializes a new type definition.
 /// </summary>
 /// <param name="token">The token of the type definition.</param>
 protected TypeDefinition(MetadataToken token)
     : base(token)
 {
     _namespace     = new LazyVariable <string>(GetNamespace);
     _name          = new LazyVariable <string>(GetName);
     _baseType      = new LazyVariable <ITypeDefOrRef>(GetBaseType);
     _declaringType = new LazyVariable <TypeDefinition>(GetDeclaringType);
     _classLayout   = new LazyVariable <ClassLayout>(GetClassLayout);
 }
Example #13
0
 /// <summary>
 /// Creates a new .NET data directory.
 /// </summary>
 public DotNetDirectory()
 {
     _metadata            = new LazyVariable <IMetadata>(GetMetadata);
     _resources           = new LazyVariable <DotNetResourcesDirectory>(GetResources);
     _strongName          = new LazyVariable <IReadableSegment>(GetStrongName);
     _codeManagerTable    = new LazyVariable <IReadableSegment>(GetCodeManagerTable);
     _exportAddressTable  = new LazyVariable <IReadableSegment>(GetExportAddressTable);
     _vtableFixups        = new LazyVariable <VTableFixupsDirectory>(GetVTableFixups);
     _managedNativeHeader = new LazyVariable <IReadableSegment>(GetManagedNativeHeader);
 }
 /// <summary>
 /// Initializes a new method definition.
 /// </summary>
 /// <param name="token">The token of the method</param>
 protected MethodDefinition(MetadataToken token)
     : base(token)
 {
     _name              = new LazyVariable <string>(GetName);
     _declaringType     = new LazyVariable <TypeDefinition>(GetDeclaringType);
     _signature         = new LazyVariable <MethodSignature>(GetSignature);
     _methodBody        = new LazyVariable <MethodBody>(GetBody);
     _implementationMap = new LazyVariable <ImplementationMap>(GetImplementationMap);
     _semantics         = new LazyVariable <MethodSemantics>(GetSemantics);
 }
Example #15
0
 /// <summary>
 /// Initializes a new field definition.
 /// </summary>
 /// <param name="token">The token of the field.</param>
 protected FieldDefinition(MetadataToken token)
     : base(token)
 {
     _name              = new LazyVariable <string>(GetName);
     _signature         = new LazyVariable <FieldSignature>(GetSignature);
     _declaringType     = new LazyVariable <TypeDefinition>(GetDeclaringType);
     _constant          = new LazyVariable <Constant>(GetConstant);
     _marshalDescriptor = new LazyVariable <MarshalDescriptor>(GetMarshalDescriptor);
     _implementationMap = new LazyVariable <ImplementationMap>(GetImplementationMap);
     _fieldRva          = new LazyVariable <ISegment>(GetFieldRva);
     _fieldOffset       = new LazyVariable <int?>(GetFieldOffset);
 }
Example #16
0
 /// <summary>
 /// Initializes a new empty module with the provided metadata token.
 /// </summary>
 /// <param name="token">The metadata token.</param>
 protected ModuleDefinition(MetadataToken token)
     : base(token)
 {
     _name              = new LazyVariable <string>(GetName);
     _mvid              = new LazyVariable <Guid>(GetMvid);
     _encId             = new LazyVariable <Guid>(GetEncId);
     _encBaseId         = new LazyVariable <Guid>(GetEncBaseId);
     _managedEntrypoint = new LazyVariable <IManagedEntrypoint>(GetManagedEntrypoint);
     _runtimeVersion    = new LazyVariable <string>(GetRuntimeVersion);
     _nativeResources   = new LazyVariable <IResourceDirectory>(GetNativeResources);
     Attributes         = DotNetDirectoryFlags.ILOnly;
 }
Example #17
0
 /// <summary>
 /// Initializes a new resource data entry.
 /// </summary>
 protected ResourceData()
 {
     _contents = new LazyVariable <ISegment>(() => GetContents());
 }
 /// <summary>
 /// Initializes a new assembly definition.
 /// </summary>
 /// <param name="token">The token of the assembly definition.</param>
 protected AssemblyDefinition(MetadataToken token)
     : base(token)
 {
     _publicKey = new LazyVariable <byte[]>(GetPublicKey);
 }
Example #19
0
 /// <summary>
 /// Initializes a new stand-alone signature.
 /// </summary>
 /// <param name="token">The token of the stand-alone signature.</param>
 protected StandAloneSignature(MetadataToken token)
     : base(token)
 {
     _signature = new LazyVariable <CallingConventionSignature>(GetSignature);
 }
Example #20
0
 /// <summary>
 /// Initializes an empty <see cref="DebugDataEntry"/> instance.
 /// </summary>
 protected DebugDataEntry()
 {
     _contents = new LazyVariable <IDebugDataSegment>(GetContents);
 }
Example #21
0
 /// <summary>
 /// Creates a new, empty tables stream.
 /// </summary>
 public TablesStream()
 {
     _layouts       = new LazyVariable <IList <TableLayout> >(GetTableLayouts);
     _tables        = new LazyVariable <IList <IMetadataTable> >(GetTables);
     _indexEncoders = CreateIndexEncoders();
 }
Example #22
0
 /// <summary>
 /// Initializes the <see cref="SecurityDeclaration"/> with a metadata token.
 /// </summary>
 /// <param name="token">The token.</param>
 protected SecurityDeclaration(MetadataToken token)
     : base(token)
 {
     _parent        = new LazyVariable <IHasSecurityDeclaration>(GetParent);
     _permissionSet = new LazyVariable <PermissionSetSignature>(GetPermissionSet);
 }
 /// <summary>
 /// Initializes the file reference with a metadata token.
 /// </summary>
 /// <param name="token">The metadata token.</param>
 protected FileReference(MetadataToken token)
     : base(token)
 {
     _name      = new LazyVariable <string>(GetName);
     _hashValue = new LazyVariable <byte[]>(GetHashValue);
 }
Example #24
0
 /// <summary>
 /// Initializes an empty method semantics object.
 /// </summary>
 /// <param name="token">The metadata token of the semantics object.</param>
 protected MethodSemantics(MetadataToken token)
     : base(token)
 {
     _method      = new LazyVariable <MethodDefinition>(GetMethod);
     _association = new LazyVariable <IHasSemantics>(GetAssociation);
 }
 /// <summary>
 /// Initializes a new stand-alone signature.
 /// </summary>
 /// <param name="token">The token of the stand-alone signature.</param>
 protected StandAloneSignature(MetadataToken token)
     : base(token)
 {
     _signature = new LazyVariable <BlobSignature>(GetSignature);
 }
Example #26
0
 /// <summary>
 /// Initializes a new empty symbol export directory.
 /// </summary>
 protected ExportDirectory()
 {
     _name = new LazyVariable<string>(GetName);
 }
 /// <summary>
 /// Initializes a new assembly reference.
 /// </summary>
 /// <param name="token">The token of the assembly reference.</param>
 protected AssemblyReference(MetadataToken token)
     : base(token)
 {
     _publicKeyOrToken = new LazyVariable <byte[]>(GetPublicKeyOrToken);
     _hashValue        = new LazyVariable <byte[]>(GetHashValue);
 }
 /// <summary>
 /// Creates a new empty method specification.
 /// </summary>
 /// <param name="token">The token of the specification.</param>
 protected MethodSpecification(MetadataToken token)
     : base(token)
 {
     _method    = new LazyVariable <IMethodDefOrRef>(GetMethod);
     _signature = new LazyVariable <GenericInstanceMethodSignature>(GetSignature);
 }
Example #29
0
 /// <summary>
 /// Initializes a new empty assembly descriptor.
 /// </summary>
 /// <param name="token">The token of the assembly descriptor.</param>
 protected AssemblyDescriptor(MetadataToken token)
     : base(token)
 {
     _name    = new LazyVariable <string>(GetName);
     _culture = new LazyVariable <string>(GetCulture);
 }
Example #30
0
 /// <summary>
 /// Initializes the constant with a metadata token.
 /// </summary>
 /// <param name="token">The metadata token.</param>
 protected Constant(MetadataToken token)
     : base(token)
 {
     _parent = new LazyVariable <IHasConstant>(GetParent);
     _value  = new LazyVariable <DataBlobSignature>(GetValue);
 }