-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPdbReader.cs
More file actions
43 lines (34 loc) · 1.18 KB
/
PdbReader.cs
File metadata and controls
43 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace WindowsPdbReader
{
using System.IO;
using System.Runtime.CompilerServices;
internal sealed class PdbReader
{
private readonly Stream stream;
private readonly int pageSize;
public PdbReader(Stream stream, int pageSize)
{
this.stream = stream;
this.pageSize = pageSize;
}
public int PageSize => this.pageSize;
public Stream Stream => this.stream;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Seek(int page, int offset)
{
this.stream.Seek((page * this.pageSize) + offset, SeekOrigin.Begin);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Read(byte[] bytes, int offset, int count)
{
this.stream.Read(bytes, offset, count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int PagesFromSize(int size)
{
return (size + this.pageSize - 1) / this.pageSize;
}
}
}