namespace DbMaker { /// /// header block class /// public class HeaderBlock { public HeaderBlock(long indexStartIp, int indexPtr) { IndexStartIp = indexStartIp; IndexPtr = indexPtr; } /// /// index block start ip address /// public long IndexStartIp { get; set; } /// /// ip address /// public int IndexPtr { get; set; } public HeaderBlock SetIndexStartIp(long indexStartIp) { IndexStartIp = indexStartIp; return this; } public HeaderBlock SetIndexPtr(int indexPtr) { IndexPtr = indexPtr; return this; } /// /// get the bytes for db storage /// /// public byte[] GetBytes() { /* * +------------+-----------+ * | 4bytes | 4bytes | * +------------+-----------+ * start ip index ptr */ var b = new byte[8]; Util.writeIntLong(b, 0, IndexStartIp); Util.writeIntLong(b, 4, IndexPtr); return b; } } }