Inheritance: MetaDataStream
Esempio n. 1
0
 internal NETTableReconstructor(TablesHeap tablesHeap)
 {
     this.tablesHeap = tablesHeap;
     this.netHeader = tablesHeap.netheader;
     stream = new MemoryStream();
     writer = new BinaryWriter(stream);
     stream.Seek(0, SeekOrigin.Begin);
 }
Esempio n. 2
0
 private void AppendMetaDataRow(TablesHeap tablesHeap, MetaDataRow row)
 {
     foreach (var part in row.Parts)
     {
         if (Marshal.SizeOf(part) == sizeof(uint))
             tablesHeap._binWriter.Write((uint)part);
         else if (Marshal.SizeOf(part) == sizeof(ushort))
             tablesHeap._binWriter.Write((ushort)part);
         else if (Marshal.SizeOf(part) == sizeof(byte))
             tablesHeap._binWriter.Write((byte)part);
         else
             throw new ArgumentException("Invalid MetaData Row");
     }
 }
Esempio n. 3
0
        internal NETTableReader(TablesHeap tablesheap)
        {
            reader = new BinaryReader(new MemoryStream(tablesheap.Contents));
            tablesheap.header = ASMGlobals.ReadStructureFromReader<Structures.METADATA_TABLE_HEADER>(reader);
            this.tableheap = tablesheap;

            for (int i = 0; i < 45; i++)
                if (tableheap.HasTable((MetaDataTableType)i))
                {
                    tableheap.tablecount++;
                }
            ReadTableHeaders();
            tableheap.tablereader = this;
               // ReadTables();
        }
Esempio n. 4
0
        public TablesDlg(MetaDataStream stream)
        {
            InitializeComponent();

            tableheap = (TablesHeap)stream.ToHeap();
            hexBox1.ByteProvider = new DynamicByteProvider(stream.Contents);
               // foreach (MetaDataMember member in tableheap.Tables.First(t => t.Type == MetaDataTableType.ManifestResource).Members)
               //     treeView1.Nodes.Add(CreateTreeNode(member));
            foreach (MetaDataTable table in tableheap.Tables)
            {
                if (table != null)
                {
                    TreeNode node = new TreeNode(table.Type.ToString() + " (" + table.AmountOfRows.ToString() + ")");
                    treeView1.Nodes.Add(node);
                    index = 1;
                    foreach (MetaDataMember member in table.Members)
                        node.Nodes.Add(CreateTreeNode(member));
                }
            }
        }
Esempio n. 5
0
        internal NETTableReader(MetaDataStream stream)
        {
            this.stream = stream;
            reader = new BinaryReader(new MemoryStream(stream.Contents));
            tableheap = new TablesHeap();
            tableheap.header = ASMGlobals.ReadStructureFromReader<Structures.METADATA_TABLE_HEADER>(reader);
            tableheap.reader = stream.reader;
            tableheap.offset = stream.offset;
            tableheap.size = stream.size;
            tableheap.stream = stream;
            tableheap.streamoffset = stream.streamoffset;
            tableheap.headeroffset = stream.headeroffset;
            tableheap.netheader = stream.netheader;

            for (int i = 0; i < 45; i++)
                if (tableheap.HasTable((MetaDataTableType)i))
                {
                    tableheap.tablecount++;
                }
            ReadTableHeaders();
            tableheap.tablereader = this;
               // ReadTables();
        }
Esempio n. 6
0
        internal NETTableReader(TablesHeap tablesheap)
        {
            using (BinaryReader reader = new BinaryReader(new MemoryStream(tablesheap.Contents)))
            {
                tablesheap._header = ASMGlobals.ReadStructureFromReader<Structures.METADATA_TABLE_HEADER>(reader);
                this.tablesHeap = tablesheap;

                for (int i = 0; i < 45; i++)
                    if (tablesHeap.HasTable((MetaDataTableType)i))
                    {
                        tablesHeap._tablecount++;
                    }

                tablesHeap._tablereader = this;
                if ((tablesHeap.HeapOffsetSizes & 1) == 1)
                    tablesHeap._netheader.StringsHeap._indexsize = 4;
                if ((tablesHeap.HeapOffsetSizes & 2) == 2)
                    tablesHeap._netheader.GuidHeap._indexsize  = 4;
                if ((tablesHeap.HeapOffsetSizes & 4) == 4)
                    tablesHeap._netheader.BlobHeap._indexsize  = 4;

                ReadTableHeaders(reader);
            }
        }
Esempio n. 7
0
 internal MetaDataTable(TablesHeap tableHeap)
 {
     TablesHeap = tableHeap;
     members = new List<MetaDataMember>();
 }
Esempio n. 8
0
        public void SetTablesHeap(TablesHeap tablesHeap)
        {
            this.currentTablesHeap = tablesHeap;
            tablesTree.Nodes.Clear();
            foreach (MetaDataTable table in tablesHeap.Tables)
            {
                if (table != null)
                {
                    TreeNode node = new TreeNode(table.Type.ToString() + " (" + table.AmountOfRows.ToString() + ")");
                    node.Tag = table;
                    if (table.AmountOfRows > 0)
                    {
                        node.Nodes.Add(new TreeNode("Loading..."));
                    }
                    tablesTree.Nodes.Add(node);

                }
            }
        }
Esempio n. 9
0
 public void SetTablesHeap(TablesHeap tablesHeap)
 {
     tablesTree.Nodes.Clear();
     foreach (MetaDataTable table in tablesHeap.Tables)
     {
         if (table != null)
         {
             TreeNode node = new TreeNode(table.Type.ToString() + " (" + table.AmountOfRows.ToString() + ")");
             tablesTree.Nodes.Add(node);
             index = 1;
             foreach (MetaDataMember member in table.Members)
                 node.Nodes.Add(CreateTreeNode(member));
         }
     }
 }
Esempio n. 10
0
 public void LoadCache()
 {
     _tableheap = TablesHeap;
     _stringsheap = StringsHeap;
     _usheap = UserStringsHeap;
     _blobheap = BlobHeap;
     _guidheap = GuidHeap;
 }
Esempio n. 11
0
 public void ClearCache()
 {
     _tableheap = null;
     _stringsheap = null;
     _usheap = null;
     _blobheap = null;
     _guidheap = null;
 }
Esempio n. 12
0
 internal MetaDataTable(TablesHeap tableHeap, bool createNew)
 {
     TablesHeap = tableHeap;
     _tablesize = -1;
 }