/// <summary> /// Creates a file reference from a file reference metadata row. /// </summary> /// <param name="parentModule">The module that contains the reference.</param> /// <param name="token">The token to initialize the reference for.</param> /// <param name="row">The metadata table row to base the member reference on.</param> public SerializedFileReference(SerializedModuleDefinition parentModule, MetadataToken token, FileReferenceRow row) : base(token) { _parentModule = parentModule ?? throw new ArgumentNullException(nameof(parentModule)); _row = row; Attributes = row.Attributes; }
private MetadataToken AddFileReference(FileReference fileReference) { var table = Metadata.TablesStream.GetTable <FileReferenceRow>(TableIndex.File); var row = new FileReferenceRow( fileReference.Attributes, Metadata.StringsStream.GetStringIndex(fileReference.Name), Metadata.BlobStream.GetBlobIndex(fileReference.HashValue)); var token = table.Add(row); AddCustomAttributes(token, fileReference); return(token); }