HeaderBlock.cs 1015 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using TEAMModelOS.SDK.IP2Region;
  2. namespace TEAMModelOS.SDK
  3. {
  4. internal class HeaderBlock
  5. {
  6. public long IndexStartIp
  7. {
  8. get;
  9. private set;
  10. }
  11. public int IndexPtr
  12. {
  13. get;
  14. private set;
  15. }
  16. public HeaderBlock(long indexStartIp, int indexPtr)
  17. {
  18. IndexStartIp = indexStartIp;
  19. IndexPtr = indexPtr;
  20. }
  21. /// <summary>
  22. /// Get the bytes for total storage
  23. /// </summary>
  24. /// <returns>
  25. /// Bytes gotten.
  26. /// </returns>
  27. public byte[] GetBytes()
  28. {
  29. /*
  30. * +------------+-----------+
  31. * | 4bytes | 4bytes |
  32. * +------------+-----------+
  33. * start ip index ptr
  34. */
  35. byte[] b = new byte[8];
  36. Utils.WriteIntLong(b, 0, IndexStartIp);
  37. Utils.WriteIntLong(b, 4, IndexPtr);
  38. return b;
  39. }
  40. }
  41. }