| 1 |
//----------------------------------------------------------------------------- |
| 2 |
// |
| 3 |
// Copyright (c) Microsoft. All rights reserved. |
| 4 |
// This code is licensed under the Microsoft Public License. |
| 5 |
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF |
| 6 |
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY |
| 7 |
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR |
| 8 |
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. |
| 9 |
// |
| 10 |
//----------------------------------------------------------------------------- |
| 11 |
using System; |
| 12 |
using System.IO; |
| 13 |
|
| 14 |
namespace Microsoft.Cci.Pdb { |
| 15 |
internal class PdbReader { |
| 16 |
internal PdbReader(Stream reader, int pageSize) { |
| 17 |
this.pageSize = pageSize; |
| 18 |
this.reader = reader; |
| 19 |
} |
| 20 |
|
| 21 |
internal void Seek(int page, int offset) { |
| 22 |
reader.Seek(page * pageSize + offset, SeekOrigin.Begin); |
| 23 |
} |
| 24 |
|
| 25 |
internal void Read(byte[] bytes, int offset, int count) { |
| 26 |
reader.Read(bytes, offset, count); |
| 27 |
} |
| 28 |
|
| 29 |
internal int PagesFromSize(int size) { |
| 30 |
return (size + pageSize - 1) / (pageSize); |
| 31 |
} |
| 32 |
|
| 33 |
//internal int PageSize { |
| 34 |
// get { return pageSize; } |
| 35 |
//} |
| 36 |
|
| 37 |
internal readonly int pageSize; |
| 38 |
internal readonly Stream reader; |
| 39 |
} |
| 40 |
} |