Exemple #1
0
        public MetadataWriter(AssemblyDefinition asm, MetadataRoot root,
                              AssemblyKind kind, TargetRuntime rt, BinaryWriter writer)
        {
            m_assembly     = asm;
            m_root         = root;
            m_runtime      = rt;
            m_imgWriter    = new ImageWriter(this, kind, writer);
            m_binaryWriter = m_imgWriter.GetTextWriter();

            m_stringCache  = new Hashtable();
            m_stringWriter = new MemoryBinaryWriter(Encoding.UTF8);
            m_stringWriter.Write((byte)0);

            m_guidCache  = new Hashtable();
            m_guidWriter = new MemoryBinaryWriter();

            m_usCache  = new Hashtable();
            m_usWriter = new MemoryBinaryWriter(Encoding.Unicode);
            m_usWriter.Write((byte)0);

            m_blobCache  = new Hashtable(ByteArrayEqualityComparer.Instance, ByteArrayEqualityComparer.Instance);
            m_blobWriter = new MemoryBinaryWriter();
            m_blobWriter.Write((byte)0);

            m_tWriter     = new MemoryBinaryWriter();
            m_tableWriter = new MetadataTableWriter(this, m_tWriter);

            m_cilWriter = new MemoryBinaryWriter();

            m_fieldDataWriter = new MemoryBinaryWriter();
            m_resWriter       = new MemoryBinaryWriter();
        }