/// <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 async Task <string> ReadNullTerminatedUnicodeStringAsync(this IReadOnlyBinaryDataAccessor accessor, long index) { int length = 0; while (await accessor.ReadAsync(index + length * 2) != 0 || await accessor.ReadAsync(index + length * 2 + 1) != 0) { length += 1; } return(accessor.ReadUnicodeString(index, length)); }