Example #1
0
        /// <summary>
        /// Loads the root stream.
        /// </summary>
        private void LoadRootStream()
        {
            // The root stream length
            int dwStreamLength = header.dwRootBytes;

            // Calculate the number of pages of the root stream
            int pageCount = (dwStreamLength / header.dwPageSize) + 1;

            // Allocate page list
            int[] pages = new int[pageCount];

            // Read the pages
            stream.Position = header.dwIndexPage * header.dwPageSize;
            for (int i = 0; i < pageCount; i++)
            {
                pages[i] = reader.ReadInt32();
                Debug.WriteLine(String.Format(@"PdbReader: Root stream page {0} (at offset {1})", pages[i], pages[i] * header.dwPageSize));
            }

            using (var pdbStream = GetStream(pages, dwStreamLength))
            {
                using (var rootReader = new BinaryReader(pdbStream))
                {
                    PdbRootStream.Read(rootReader, header.dwPageSize, out root);
                }
            }
        }