-
Notifications
You must be signed in to change notification settings - Fork 5
/
SLFileHeader.cs
31 lines (24 loc) · 1.03 KB
/
SLFileHeader.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
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace SL3Reader
{
[StructLayout(LayoutKind.Sequential, Size = Size)]
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
public readonly ref struct SLFileHeader
{
public const int Size = 8;
private readonly LogFileFormat fileFormat;
private readonly short deviceID;
private readonly short blockSize;
private readonly short reserved;
public readonly LogFileFormat FileFormat => fileFormat;
public readonly short DeviceID => deviceID;
public readonly short BlockSize => blockSize;
public readonly short Reserved => reserved;
public readonly override string ToString() => fileFormat.ToString() + " (" + blockSize.ToString() + ')';
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly bool IsValidFormat(LogFileFormat fileFormatToTest) =>
fileFormat == fileFormatToTest;
}
}