internal static string ReadString(Stream source, ushort length)
{
// Check if any data will be read
if (length == 0)
{
// Instead of returning an empty string later we just return NULL
return null;
}
// Allocate buffer
byte[] byteString = new byte[length];
// Read into a byte buffer
source.Read(byteString, 0, byteString.Length);
// Convert
return Encoding.Unicode.GetString(byteString, 0, byteString.Length);
}