1 | //----------------------------------------------------------------------------- |
---|
2 | // |
---|
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. |
---|
4 | // |
---|
5 | //----------------------------------------------------------------------------- |
---|
6 | using System; |
---|
7 | |
---|
8 | namespace Microsoft.Cci.Pdb { |
---|
9 | internal class MsfDirectory { |
---|
10 | internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits) { |
---|
11 | bits.MinCapacity(head.directorySize); |
---|
12 | int pages = reader.PagesFromSize(head.directorySize); |
---|
13 | |
---|
14 | // 0..n in page of directory pages. |
---|
15 | reader.Seek(head.directoryRoot, 0); |
---|
16 | bits.FillBuffer(reader.reader, pages * 4); |
---|
17 | |
---|
18 | DataStream stream = new DataStream(head.directorySize, bits, pages); |
---|
19 | bits.MinCapacity(head.directorySize); |
---|
20 | stream.Read(reader, bits); |
---|
21 | |
---|
22 | // 0..3 in directory pages |
---|
23 | int count; |
---|
24 | bits.ReadInt32(out count); |
---|
25 | |
---|
26 | // 4..n |
---|
27 | int[] sizes = new int[count]; |
---|
28 | bits.ReadInt32(sizes); |
---|
29 | |
---|
30 | // n..m |
---|
31 | streams = new DataStream[count]; |
---|
32 | for (int i = 0; i < count; i++) { |
---|
33 | if (sizes[i] <= 0) { |
---|
34 | streams[i] = new DataStream(); |
---|
35 | } else { |
---|
36 | streams[i] = new DataStream(sizes[i], bits, |
---|
37 | reader.PagesFromSize(sizes[i])); |
---|
38 | } |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | internal DataStream[] streams; |
---|
43 | } |
---|
44 | |
---|
45 | } |
---|