/// <summary>
/// Initializes a new <see cref="CKExceptionData"/> from a <see cref="CKBinaryReader"/>
/// with a known version.
/// See <see cref="Write(CKBinaryWriter,bool)"/>.
/// </summary>
/// <param name="r">The reader to read from.</param>
/// <param name="streamIsCRLF">Whether the strings have CRLF or LF for end-of-lines.</param>
/// <param name="version">Known version.</param>
public CKExceptionData(CKBinaryReader r, bool streamIsCRLF, int version)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
_message = r.ReadString(streamIsCRLF);
_exceptionTypeName = r.ReadString();
_exceptionTypeAQName = r.ReadString();
_stackTrace = r.ReadNullableString(streamIsCRLF);
_fileName = r.ReadNullableString();
_detailedInfo = r.ReadNullableString(streamIsCRLF);
int nbAgg = version == 0 ? r.ReadInt32() : r.ReadSmallInt32();
if (nbAgg > 0)
{
_aggregatedExceptions = new CKExceptionData[nbAgg];
for (int i = 0; i < nbAgg; ++i)
{
_aggregatedExceptions[i] = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
}
_innerException = _aggregatedExceptions[0];
}
else
{
if (nbAgg == 0)
{
_innerException = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
}
}
int nbLd = version == 0 ? r.ReadInt32() : r.ReadNonNegativeSmallInt32();
if (nbLd != 0)
{
_loaderExceptions = new CKExceptionData[nbLd];
for (int i = 0; i < nbLd; ++i)
{
_loaderExceptions[i] = new CKExceptionData(r, streamIsCRLF, version == 0 ? r.ReadInt32() : version);
}
}
}