private string ReadWideString(bool nullTerminated)
{
int length = reader.ReadInt32() - (nullTerminated ? 1 : 0);
byte[] bytes = reader.ReadBytes(length * 2);
string str = System.Text.Encoding.Unicode.GetString(bytes);
if (nullTerminated)
{
if (reader.ReadUInt16() != 0)
throw new InvalidFormatException("Illegal null terminated widestring");
}
return str;
}
}