Version.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Utilities;
  11. namespace SMBLibrary.RPC
  12. {
  13. /// <summary>
  14. /// version_t
  15. /// </summary>
  16. public struct Version
  17. {
  18. public const int Length = 2;
  19. public byte Major; // major
  20. public byte Minor; // minor
  21. public Version(byte[] buffer, int offset)
  22. {
  23. Major = ByteReader.ReadByte(buffer, offset + 0);
  24. Minor = ByteReader.ReadByte(buffer, offset + 1);
  25. }
  26. public void WriteBytes(byte[] buffer, int offset)
  27. {
  28. ByteWriter.WriteByte(buffer, offset + 0, Major);
  29. ByteWriter.WriteByte(buffer, offset + 1, Minor);
  30. }
  31. }
  32. }