Example #1
0
        bool LoadMetadataTables()
        {
            var pStreamHeader = (StreamHeader *)m_streams[(int)StreamID.MetadataTables];

            if (pStreamHeader == null)
            {
                return(false);
            }
            m_metadataTableHeader = (MetadataTableHeader *)checked ((byte *)m_metadataRoot + pStreamHeader->Offset);
            if (!m_metadataTableHeader->Verify())
            {
                return(false);
            }
            ComputeCodedIndexSizes();
            m_tables = new byte *[(int)MetadataTable.MAX_TABLE_ID + 1];
            var pCurrent = (byte *)m_metadataTableHeader + m_metadataTableHeader->Size;

            for (MetadataTable i = 0; i <= MetadataTable.MAX_TABLE_ID; ++i)
            {
                if (GetRowCount(i) != 0)
                {
                    m_tables[(int)i] = pCurrent;
                    pCurrent        += GetRowSize(i) * GetRowCount(i);
                }
            }
            return(true);
        }
Example #2
0
        public void Dispose()
        {
            m_assembly            = null;
            m_metadataTableHeader = null;
            m_pData          = null;
            m_fileSize       = 0;
            m_peHeader       = null;
            m_optionalHeader = null;
            m_clrHeader      = null;
            m_streams        = null;
            m_fullPath       = null;

            if (m_tables != null)
            {
                for (var i = 0; i < m_tables.Length; ++i)
                {
                    m_tables[i] = null;
                }
                m_tables = null;
            }

            if (m_memoryMap != null)
            {
                m_memoryMap.Dispose();
                m_memoryMap = null;
            }
        }