You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
//*******************************
|
|
// Created By Rocher Kong
|
|
// Github https://github.com/RocherKong
|
|
// Date 2018.02.09
|
|
//*******************************
|
|
|
|
namespace IP2Region.Models
|
|
{
|
|
internal class HeaderBlock
|
|
{
|
|
public long IndexStartIp
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public int IndexPtr
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public HeaderBlock(long indexStartIp, int indexPtr)
|
|
{
|
|
IndexStartIp = indexStartIp;
|
|
IndexPtr = indexPtr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the bytes for total storage
|
|
/// </summary>
|
|
/// <returns>
|
|
/// Bytes gotten.
|
|
/// </returns>
|
|
public byte[] GetBytes()
|
|
{
|
|
/*
|
|
* +------------+-----------+
|
|
* | 4bytes | 4bytes |
|
|
* +------------+-----------+
|
|
* start ip index ptr
|
|
*/
|
|
byte[] b = new byte[8];
|
|
Utils.WriteIntLong(b, 0, IndexStartIp);
|
|
Utils.WriteIntLong(b, 4, IndexPtr);
|
|
return b;
|
|
}
|
|
}
|
|
}
|