in src/Proton/Codec/Decoders/Messaging/PropertiesTypeDecoder.cs [175:256]
private static Properties ReadProperties(Stream stream, IStreamDecoderState state, IListTypeDecoder listDecoder)
{
Properties result = new();
_ = listDecoder.ReadSize(stream, state);
int count = listDecoder.ReadCount(stream, state);
// Don't decode anything if things already look wrong.
if (count < MinPropertiesListEntries)
{
throw new DecodeException("Not enough entries in Properties list encoding: " + count);
}
if (count > MaxPropertiesListEntries)
{
throw new DecodeException("To many entries in Properties list encoding: " + count);
}
for (int index = 0; index < count; ++index)
{
// Peek ahead and see if there is a null in the next slot, if so we don't call
// the setter for that entry to ensure the returned type reflects the encoded
// state in the modification entry.
if (stream.CanSeek)
{
bool nullValue = stream.ReadByte() == (byte)EncodingCodes.Null;
if (nullValue)
{
continue;
}
else
{
stream.Seek(-1, SeekOrigin.Current);
}
}
switch (index)
{
case 0:
result.MessageId = state.Decoder.ReadObject(stream, state);
break;
case 1:
result.UserId = state.Decoder.ReadBinary(stream, state);
break;
case 2:
result.To = state.Decoder.ReadString(stream, state);
break;
case 3:
result.Subject = state.Decoder.ReadString(stream, state);
break;
case 4:
result.ReplyTo = state.Decoder.ReadString(stream, state);
break;
case 5:
result.CorrelationId = state.Decoder.ReadObject(stream, state);
break;
case 6:
result.ContentType = state.Decoder.ReadSymbol(stream, state)?.ToString() ?? null;
break;
case 7:
result.ContentEncoding = state.Decoder.ReadSymbol(stream, state)?.ToString() ?? null;
break;
case 8:
result.AbsoluteExpiryTime = state.Decoder.ReadTimestamp(stream, state) ?? 0;
break;
case 9:
result.CreationTime = state.Decoder.ReadTimestamp(stream, state) ?? 0;
break;
case 10:
result.GroupId = state.Decoder.ReadString(stream, state);
break;
case 11:
result.GroupSequence = state.Decoder.ReadUnsignedInteger(stream, state) ?? 0;
break;
case 12:
result.ReplyToGroupId = state.Decoder.ReadString(stream, state);
break;
}
}
return result;
}