byte[] ReadStrPascal(IO.EndianReader s, out int actualCount) { actualCount = TypeExtensions.kNone; int length; // One would think that the length prefix would be of the same endian as the stream, but just in case... using (s.BeginEndianSwitch(mStorage.ByteOrder)) switch (mStorage.LengthPrefix) { case StringStorageLengthPrefix.Int7: length = s.Read7BitEncodedInt(); break; case StringStorageLengthPrefix.Int8: length = s.ReadByte(); break; case StringStorageLengthPrefix.Int16: length = s.ReadInt16(); break; case StringStorageLengthPrefix.Int32: length = s.ReadInt32(); break; default: throw new Debug.UnreachableException(); } return(s.ReadBytes(GetMaxCleanByteCount(length))); }