/// <summary>
        /// Reads a null-terminated UTF-16 string
        /// </summary>
        /// <param name="offset">Offset of the string</param>
        /// <returns>The UTF-16 string</returns>
        public static string ReadNullTerminatedUnicodeString(this IReadOnlyBinaryDataAccessor accessor, long index)
        {
            int length = 0;

            while (accessor.Read(index + length * 2) != 0 || accessor.Read(index + length * 2 + 1) != 0)
            {
                length += 1;
            }
            return(accessor.ReadUnicodeString(index, length));
        }
        /// <summary>
        /// Reads an unsigned 64 bit big endian integer
        /// </summary>
        /// <param name="offset">Offset of the integer to read.</param>
        /// <returns>The integer from the given location</returns>
        public static UInt64 ReadUInt64BigEndian(this IReadOnlyBinaryDataAccessor accessor, long offset)
        {
            var bytes = accessor.Read(offset, 8);

            Array.Reverse(bytes);
            return(BitConverter.ToUInt64(bytes, 0));
        }
        /// <summary>
        /// Reads a signed 32 bit big endian integer
        /// </summary>
        /// <param name="offset">Offset of the integer to read.</param>
        /// <returns>The integer from the given location</returns>
        public static Int32 ReadInt32BigEndian(this IReadOnlyBinaryDataAccessor accessor, long offset)
        {
            var bytes = accessor.Read(offset, 4);

            Array.Reverse(bytes);
            return(BitConverter.ToInt32(bytes, 0));
        }
        /// <summary>
        /// Reads a null-terminated string using the given encoding
        /// </summary>
        /// <param name="offset">Offset of the string</param>
        /// <returns>The string at the given location</returns>
        public static string ReadNullTerminatedString(this IReadOnlyBinaryDataAccessor accessor, long index, Encoding e)
        {
            // The null character we're looking for
            var nullCharSequence = e.GetBytes(Convert.ToChar(0x0).ToString());

            // Find the length of the string as determined by the location of the null-char sequence
            int length = 0;

            while (!accessor.Read(index + length * nullCharSequence.Length, nullCharSequence.Length).All(x => x == 0))
            {
                length += 1;
            }

            return(accessor.ReadString(index, length, e));
        }
 /// <summary>
 /// Reads a signed 32 bit little endian integer
 /// </summary>
 /// <param name="offset">Offset of the integer to read.</param>
 /// <returns>The integer from the given location</returns>
 public static Int32 ReadInt32(this IReadOnlyBinaryDataAccessor accessor, long offset)
 {
     return(BitConverter.ToInt32(accessor.Read(offset, 4), 0));
 }
 /// <summary>
 /// Reads a string using the given encoding
 /// </summary>
 /// <param name="offset">Offset of the string</param>
 /// <param name="length">Length in characters of the string</param>
 /// <returns>The UTF-16 string at the given offset</returns>
 public static string ReadString(this IReadOnlyBinaryDataAccessor accessor, long index, int length, Encoding e)
 {
     return(e.GetString(accessor.Read(index, length), 0, length));
 }
 /// <summary>
 /// Reads a UTF-16 string
 /// </summary>
 /// <param name="offset">Offset of the string</param>
 /// <param name="length">Length in characters of the string</param>
 /// <returns>The UTF-16 string at the given offset</returns>
 public static string ReadUnicodeString(this IReadOnlyBinaryDataAccessor accessor, long index, int length)
 {
     return(Encoding.Unicode.GetString(accessor.Read(index, length * 2), 0, length * 2));
 }
 /// <summary>
 /// Reads an unsigned 64 bit little endian integer
 /// </summary>
 /// <param name="offset">Offset of the integer to read.</param>
 /// <returns>The integer from the given location</returns>
 public static UInt64 ReadUInt64(this IReadOnlyBinaryDataAccessor accessor, long offset)
 {
     return(BitConverter.ToUInt64(accessor.Read(offset, 8), 0));
 }