-
Notifications
You must be signed in to change notification settings - Fork 0
/
WlkFileHeader.cs
33 lines (29 loc) · 981 Bytes
/
WlkFileHeader.cs
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
namespace ImportWLK
{
struct DayIndex
{
public short RecordsInDay; // includes any daily summary records
public int StartPosition; // The index (starting at 0) of the first daily summary record
};
internal class WlkFileHeader
{
public char[] IdCode; // 16 bytes, Static header - should be: {'W', 'D', 'A', 'T', '5', '.', '0', 0, 0, 0, 0, 0, 0, 0, 5, 0}
public int TotalRecords; // 4 bytes, Total number of records in the file
public DayIndex[] DayIndices; // 32 * (2 + 4) = 192 bytes, index records for each day. Index 0 is not used
// (i.e. the 1'st is at index 1, not index 0)
public void ReadFile(BinaryReader reader)
{
IdCode = reader.ReadChars(16);
TotalRecords = reader.ReadInt32();
DayIndices = new DayIndex[32];
for (int i = 0; i < 32; i++)
{
DayIndices[i] = new DayIndex
{
RecordsInDay = reader.ReadInt16(),
StartPosition = reader.ReadInt32()
};
}
}
}
}