-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapEntry.cs
More file actions
34 lines (26 loc) · 725 Bytes
/
MapEntry.cs
File metadata and controls
34 lines (26 loc) · 725 Bytes
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
using System;
using System.Globalization;
public class MapEntry
{
public long Offset;
public int Length;
public bool Found;
public long LocalOffset;
public int LocalLength;
public static MapEntry Parse(string line)
{
MapEntry entry = new MapEntry();
string[] parts = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
entry.Offset = long.Parse(parts[0].Replace("0x", ""), NumberStyles.AllowHexSpecifier);
entry.Length = int.Parse(parts[1].Replace("0x", ""), NumberStyles.AllowHexSpecifier);
return entry;
}
public bool Intersects(long offset, int length)
{
if (offset + length <= this.Offset)
return false;
if (offset >= this.Offset + this.Length)
return false;
return true;
}
}