Esempio n. 1
0
        /// <summary>
        /// Writes the nested class table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteNestedClassTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            NestedClassRow row;

            WriteTable(TokenTypes.NestedClass, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.NestedClassTableIdx);
                metadataWriter.Write(row.EnclosingClassTableIdx);
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Writes the field RVA table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldRVATable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldRVARow row;

            WriteTable(TokenTypes.FieldRVA, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Rva);
                metadataWriter.Write(row.FieldTableIdx);
            });
        }
Esempio n. 3
0
        /// <summary>
        /// Writes the property map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WritePropertyMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            PropertyMapRow row;

            WriteTable(TokenTypes.PropertyMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.ParentTableIdx);
                metadataWriter.Write(row.PropertyTableIdx);
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Writes the event map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteEventMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            EventMapRow row;

            WriteTable(TokenTypes.EventMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.TypeDefTableIdx);
                metadataWriter.Write(row.EventListTableIdx);
            });
        }
Esempio n. 5
0
        /// <summary>
        /// Writes the field layout table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldLayoutTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldLayoutRow row;

            WriteTable(TokenTypes.FieldLayout, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Offset);
                metadataWriter.Write(row.Field);
            });
        }
Esempio n. 6
0
        /// <summary>
        /// Writes the assembly ref processor table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteAssemblyRefProcessorTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            AssemblyRefProcessorRow row;

            WriteTable(TokenTypes.AssemblyRefProcessor, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Processor);
                metadataWriter.Write(row.AssemblyRef);
            });
        }
Esempio n. 7
0
        /// <summary>
        /// Writes the class layout table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteClassLayoutTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ClassLayoutRow row;

            WriteTable(TokenTypes.ClassLayout, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.PackingSize);
                metadataWriter.Write((uint)row.ClassSize);
                metadataWriter.Write(row.ParentTypeDefIdx);
            });
        }
Esempio n. 8
0
        /// <summary>
        /// Writes the assembly OS table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteAssemblyOSTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            AssemblyOSRow row;

            WriteTable(TokenTypes.AssemblyOS, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.PlatformId);
                metadataWriter.Write((uint)row.MajorVersion);
                metadataWriter.Write((uint)row.MinorVersion);
            });
        }
Esempio n. 9
0
        /// <summary>
        /// Writes the method semantics table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodSemanticsTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodSemanticsRow row;

            WriteTable(TokenTypes.MethodSemantics, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Semantics);
                metadataWriter.Write(row.MethodTableIdx);
                metadataWriter.WriteHasSemanticsIndex(row.AssociationTableIdx);
            });
        }
Esempio n. 10
0
        /// <summary>
        /// Writes the property table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WritePropertyTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            PropertyRow row;

            WriteTable(TokenTypes.Property, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.TypeBlobIdx);
            });
        }
Esempio n. 11
0
        /// <summary>
        /// Writes the typeref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeRefRow row;

            WriteTable(TokenTypes.TypeRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteResolutionScopeIndex(row.ResolutionScopeIdx);
                metadataWriter.Write(row.TypeNameIdx);
                metadataWriter.Write(row.TypeNamespaceIdx);
            });
        }
Esempio n. 12
0
        /// <summary>
        /// Writes the event table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteEventTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            EventRow row;

            WriteTable(TokenTypes.Event, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.EventTypeTableIdx);
            });
        }
Esempio n. 13
0
        /// <summary>
        /// Writes the decl security table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteDeclSecurityTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            DeclSecurityRow row;

            WriteTable(TokenTypes.DeclSecurity, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Action);
                metadataWriter.WriteHasDeclSecurityIndex(row.ParentTableIdx);
                metadataWriter.Write(row.PermissionSetBlobIdx);
            });
        }
Esempio n. 14
0
        /// <summary>
        /// Writes the file table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFileTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FileRow row;

            WriteTable(TokenTypes.File, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.HashValueBlobIdx);
            });
        }
Esempio n. 15
0
        /// <summary>
        /// Writes the member ref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMemberRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MemberRefRow row;

            WriteTable(TokenTypes.MemberRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteMemberRefParentIndex(row.ClassTableIdx);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
Esempio n. 16
0
        /// <summary>
        /// Writes the param table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteParamTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ParamRow row;

            WriteTable(TokenTypes.Param, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write((ushort)row.Sequence);
                metadataWriter.Write(row.NameIdx);
            });
        }
Esempio n. 17
0
        /// <summary>
        /// Writes the field table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldRow row;

            WriteTable(TokenTypes.Field, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
Esempio n. 18
0
        /// <summary>
        /// Writes the impl map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteImplMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ImplMapRow row;

            WriteTable(TokenTypes.ImplMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.MappingFlags);
                metadataWriter.WriteMemberForwardedIndex(row.MemberForwardedTableIdx);
                metadataWriter.Write(row.ImportNameStringIdx);
                metadataWriter.Write(row.ImportScopeTableIdx);
            });
        }
Esempio n. 19
0
        /// <summary>
        /// Writes the constant table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteConstantTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ConstantRow row;

            WriteTable(TokenTypes.Constant, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((byte)row.Type);
                metadataWriter.Write((byte)0);
                metadataWriter.WriteHasConstantIndex(row.Parent);
                metadataWriter.Write(row.ValueBlobIdx);
            });
        }
Esempio n. 20
0
        /// <summary>
        /// Writes the module table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteModuleTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ModuleRow row;

            WriteTable(TokenTypes.Module, metadataSource, token =>
            {
                metadataSource.Read(token, out row);
                metadataWriter.Write(row.Generation);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.MvidGuidIdx);
                metadataWriter.Write(row.EncIdGuidIdx);
                metadataWriter.Write(row.EncBaseIdGuidIdx);
            });
        }
Esempio n. 21
0
        /// <summary>
        /// Writes the generic param table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteGenericParamTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            GenericParamRow row;

            WriteTable(TokenTypes.GenericParam, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Number);
                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.WriteTypeOrMethodDefIndex(row.OwnerTableIdx);
                metadataWriter.Write(row.NameStringIdx);
            });
        }
Esempio n. 22
0
        /// <summary>
        /// Writes the manifest resource table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteManifestResourceTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ManifestResourceRow row;

            WriteTable(TokenTypes.ManifestResource, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Offset);
                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.WriteImplementationIndex(row.ImplementationTableIdx);
            });
        }
Esempio n. 23
0
        /// <summary>
        /// Writes the exported type table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteExportedTypeTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ExportedTypeRow row;

            WriteTable(TokenTypes.ExportedType, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.TypeDefTableIdx);
                metadataWriter.Write(row.TypeNameStringIdx);
                metadataWriter.Write(row.TypeNamespaceStringIdx);
                metadataWriter.WriteImplementationIndex(row.ImplementationTableIdx);
            });
        }
Esempio n. 24
0
        /// <summary>
        /// Writes the typedef table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeDefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeDefRow row;

            WriteTable(TokenTypes.TypeDef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.TypeNameIdx);
                metadataWriter.Write(row.TypeNamespaceIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.Extends);
                metadataWriter.Write(row.FieldList);
                metadataWriter.Write(row.MethodList);
            });
        }
Esempio n. 25
0
        /// <summary>
        /// Writes the standalone sig table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteStandaloneSigTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            StandAloneSigRow row;

            WriteTable(TokenTypes.StandAloneSig, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
Esempio n. 26
0
        /// <summary>
        /// Writes the module ref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteModuleRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ModuleRefRow row;

            WriteTable(TokenTypes.ModuleRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.NameStringIdx);
            });
        }
Esempio n. 27
0
        /// <summary>
        /// Writes the type spec table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeSpecTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeSpecRow row;

            WriteTable(TokenTypes.TypeSpec, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
Esempio n. 28
0
        /// <summary>
        /// Writes the method spec table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodSpecTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodSpecRow row;

            WriteTable(TokenTypes.MethodSpec, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteMethodDefOrRefIndex(row.MethodTableIdx);
                metadataWriter.Write(row.InstantiationBlobIdx);
            });
        }
Esempio n. 29
0
        /// <summary>
        /// Writes the field marshal table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldMarshalTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldMarshalRow row;

            WriteTable(TokenTypes.FieldMarshal, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteHasFieldMarshalIndex(row.ParentTableIdx);
                metadataWriter.Write(row.NativeTypeBlobIdx);
            });
        }
Esempio n. 30
0
        /// <summary>
        /// Writes the generic param constraint table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteGenericParamConstraintTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            GenericParamConstraintRow row;

            WriteTable(TokenTypes.GenericParamConstraint, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.OwnerTableIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.ConstraintTableIdx);
            });
        }
        /// <summary>
        /// Writes the member ref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMemberRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MemberRefRow row;

            WriteTable(TokenTypes.MemberRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteMemberRefParentIndex(row.ClassTableIdx);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
        /// <summary>
        /// Writes the standalone sig table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteStandaloneSigTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            StandAloneSigRow row;

            WriteTable(TokenTypes.StandAloneSig, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
        /// <summary>
        /// Writes the decl security table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteDeclSecurityTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            DeclSecurityRow row;

            WriteTable(TokenTypes.DeclSecurity, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Action);
                metadataWriter.WriteHasDeclSecurityIndex(row.ParentTableIdx);
                metadataWriter.Write(row.PermissionSetBlobIdx);
            });
        }
        /// <summary>
        /// Writes the nested class table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteNestedClassTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            NestedClassRow row;

            WriteTable(TokenTypes.NestedClass, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.NestedClassTableIdx);
                metadataWriter.Write(row.EnclosingClassTableIdx);
            });
        }
        /// <summary>
        /// Writes the property map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WritePropertyMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            PropertyMapRow row;

            WriteTable(TokenTypes.PropertyMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.ParentTableIdx);
                metadataWriter.Write(row.PropertyTableIdx);
            });
        }
        /// <summary>
        /// Writes the method semantics table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodSemanticsTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodSemanticsRow row;
            WriteTable(TokenTypes.MethodSemantics, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Semantics);
                metadataWriter.Write(row.MethodTableIdx);
                metadataWriter.WriteHasSemanticsIndex(row.AssociationTableIdx);
            });
        }
        /// <summary>
        /// Writes the module ref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteModuleRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ModuleRefRow row;

            WriteTable(TokenTypes.ModuleRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.NameStringIdx);
            });
        }
        /// <summary>
        /// Writes the field RVA table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldRVATable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldRVARow row;

            WriteTable(TokenTypes.FieldRVA, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Rva);
                metadataWriter.Write(row.FieldTableIdx);
            });
        }
        /// <summary>
        /// Writes the field table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldRow row;

            WriteTable(TokenTypes.Field, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
        /// <summary>
        /// Writes the field layout table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldLayoutTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldLayoutRow row;

            WriteTable(TokenTypes.FieldLayout, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Offset);
                metadataWriter.Write(row.Field);
            });
        }
        /// <summary>
        /// Writes the field marshal table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFieldMarshalTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FieldMarshalRow row;

            WriteTable(TokenTypes.FieldMarshal, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteHasFieldMarshalIndex(row.ParentTableIdx);
                metadataWriter.Write(row.NativeTypeBlobIdx);
            });
        }
        /// <summary>
        /// Writes the exported type table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteExportedTypeTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ExportedTypeRow row;

            WriteTable(TokenTypes.ExportedType, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.TypeDefTableIdx);
                metadataWriter.Write(row.TypeNameStringIdx);
                metadataWriter.Write(row.TypeNamespaceStringIdx);
                metadataWriter.WriteImplementationIndex(row.ImplementationTableIdx);
            });
        }
        /// <summary>
        /// Writes the event table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteEventTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            EventRow row;

            WriteTable(TokenTypes.Event, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.EventTypeTableIdx);
            });
        }
        /// <summary>
        /// Writes the event map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteEventMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            EventMapRow row;

            WriteTable(TokenTypes.EventMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.TypeDefTableIdx);
                metadataWriter.Write(row.EventListTableIdx);
            });
        }
        /// <summary>
        /// Writes the methoddef table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodDefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodDefRow row;

            WriteTable(TokenTypes.MethodDef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Rva);
                metadataWriter.Write((ushort)row.ImplFlags);
                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.SignatureBlobIdx);
                metadataWriter.Write(row.ParamList);
            });
        }
        /// <summary>
        /// Writes the file table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteFileTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            FileRow row;

            WriteTable(TokenTypes.File, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.HashValueBlobIdx);
            });
        }
        /// <summary>
        /// Writes the method impl table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodImplTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodImplRow row;

            WriteTable(TokenTypes.MethodImpl, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.ClassTableIdx);
                metadataWriter.WriteMethodDefOrRefIndex(row.MethodBodyTableIdx);
                metadataWriter.WriteMethodDefOrRefIndex(row.MethodDeclarationTableIdx);
            });
        }
        /// <summary>
        /// Writes the generic param constraint table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteGenericParamConstraintTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            GenericParamConstraintRow row;

            WriteTable(TokenTypes.GenericParamConstraint, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.OwnerTableIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.ConstraintTableIdx);
            });
        }
        /// <summary>
        /// Writes the method spec table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteMethodSpecTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            MethodSpecRow row;

            WriteTable(TokenTypes.MethodSpec, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteMethodDefOrRefIndex(row.MethodTableIdx);
                metadataWriter.Write(row.InstantiationBlobIdx);
            });
        }
        /// <summary>
        /// Writes the generic param table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteGenericParamTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            GenericParamRow row;

            WriteTable(TokenTypes.GenericParam, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Number);
                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.WriteTypeOrMethodDefIndex(row.OwnerTableIdx);
                metadataWriter.Write(row.NameStringIdx);
            });
        }
        /// <summary>
        /// Writes the module table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteModuleTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ModuleRow row;

            WriteTable(TokenTypes.Module, metadataSource, token =>
            {
                metadataSource.Read(token, out row);
                metadataWriter.Write(row.Generation);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.MvidGuidIdx);
                metadataWriter.Write(row.EncIdGuidIdx);
                metadataWriter.Write(row.EncBaseIdGuidIdx);
            });
        }
        /// <summary>
        /// Writes the impl map table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteImplMapTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ImplMapRow row;

            WriteTable(TokenTypes.ImplMap, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.MappingFlags);
                metadataWriter.WriteMemberForwardedIndex(row.MemberForwardedTableIdx);
                metadataWriter.Write(row.ImportNameStringIdx);
                metadataWriter.Write(row.ImportScopeTableIdx);
            });
        }
        /// <summary>
        /// Writes the param table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteParamTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ParamRow row;

            WriteTable(TokenTypes.Param, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write((ushort)row.Sequence);
                metadataWriter.Write(row.NameIdx);
            });
        }
        /// <summary>
        /// Writes the interfaceimpl table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteInterfaceImplTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            InterfaceImplRow row;

            WriteTable(TokenTypes.InterfaceImpl, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.ClassTableIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.InterfaceTableIdx);
            });
        }
        /// <summary>
        /// Writes the property table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WritePropertyTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            PropertyRow row;

            WriteTable(TokenTypes.Property, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((ushort)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.Write(row.TypeBlobIdx);
            });
        }
        /// <summary>
        /// Writes the manifest resource table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteManifestResourceTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            ManifestResourceRow row;

            WriteTable(TokenTypes.ManifestResource, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.Offset);
                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.NameStringIdx);
                metadataWriter.WriteImplementationIndex(row.ImplementationTableIdx);
            });
        }
        /// <summary>
        /// Writes the typedef table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeDefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeDefRow row;

            WriteTable(TokenTypes.TypeDef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write((uint)row.Flags);
                metadataWriter.Write(row.TypeNameIdx);
                metadataWriter.Write(row.TypeNamespaceIdx);
                metadataWriter.WriteTypeDefOrRefIndex(row.Extends);
                metadataWriter.Write(row.FieldList);
                metadataWriter.Write(row.MethodList);
            });
        }
        /// <summary>
        /// Writes the typeref table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeRefTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeRefRow row;

            WriteTable(TokenTypes.TypeRef, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteResolutionScopeIndex(row.ResolutionScopeIdx);
                metadataWriter.Write(row.TypeNameIdx);
                metadataWriter.Write(row.TypeNamespaceIdx);
            });
        }
        /// <summary>
        /// Writes the type spec table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteTypeSpecTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            TypeSpecRow row;

            WriteTable(TokenTypes.TypeSpec, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.Write(row.SignatureBlobIdx);
            });
        }
        /// <summary>
        /// Writes the custom attribute table.
        /// </summary>
        /// <param name="metadataSource">The metadata source.</param>
        /// <param name="metadataWriter">The metadata writer.</param>
        private static void WriteCustomAttributeTable(IMetadataProvider metadataSource, MetadataBuilderStage metadataWriter)
        {
            CustomAttributeRow row;

            WriteTable(TokenTypes.CustomAttribute, metadataSource, token =>
            {
                metadataSource.Read(token, out row);

                metadataWriter.WriteHasCustomAttributeIndex(row.ParentTableIdx);
                metadataWriter.WriteCustomAttributeTypeIndex(row.TypeIdx);
                metadataWriter.Write(row.ValueBlobIdx);
            });
        }