LittleEndianReader.cs 884 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Utilities
  5. {
  6. public class LittleEndianReader
  7. {
  8. public static ushort ReadUInt16(byte[] buffer, ref int offset)
  9. {
  10. offset += 2;
  11. return LittleEndianConverter.ToUInt16(buffer, offset - 2);
  12. }
  13. public static uint ReadUInt32(byte[] buffer, ref int offset)
  14. {
  15. offset += 4;
  16. return LittleEndianConverter.ToUInt32(buffer, offset - 4);
  17. }
  18. public static ulong ReadUInt64(byte[] buffer, ref int offset)
  19. {
  20. offset += 8;
  21. return LittleEndianConverter.ToUInt64(buffer, offset - 8);
  22. }
  23. public static Guid ReadGuid(byte[] buffer, ref int offset)
  24. {
  25. offset += 16;
  26. return LittleEndianConverter.ToGuid(buffer, offset - 16);
  27. }
  28. }
  29. }