HistoryRecordInfo.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Technitium DNS Server
  3. Copyright (C) 2024 Shreyas Zare (shreyas@technitium.com)
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. using System;
  16. using System.IO;
  17. using TechnitiumLibrary.IO;
  18. namespace DnsServerCore.Dns.ResourceRecords
  19. {
  20. class HistoryRecordInfo : AuthRecordInfo
  21. {
  22. #region variables
  23. DateTime _deletedOn;
  24. #endregion
  25. #region constructor
  26. public HistoryRecordInfo()
  27. { }
  28. public HistoryRecordInfo(BinaryReader bR)
  29. : base(bR)
  30. { }
  31. #endregion
  32. #region static
  33. public static HistoryRecordInfo ReadFrom(BinaryReader bR)
  34. {
  35. return new HistoryRecordInfo(bR);
  36. }
  37. #endregion
  38. #region protected
  39. protected override void ReadRecordInfoFrom(BinaryReader bR)
  40. {
  41. byte version = bR.ReadByte();
  42. switch (version)
  43. {
  44. case 1:
  45. _deletedOn = bR.ReadDateTime();
  46. break;
  47. default:
  48. throw new InvalidDataException("HistoryRecordInfo format version not supported.");
  49. }
  50. }
  51. protected override void WriteRecordInfoTo(BinaryWriter bW)
  52. {
  53. bW.Write((byte)1); //version
  54. bW.Write(_deletedOn);
  55. }
  56. #endregion
  57. #region properties
  58. public DateTime DeletedOn
  59. {
  60. get { return _deletedOn; }
  61. set { _deletedOn = value; }
  62. }
  63. #endregion
  64. }
  65. }