in src/Proton/Codec/Decoders/Messaging/PropertiesTypeDecoder.cs [68:143]
private static Properties ReadProperties(IProtonBuffer buffer, IDecoderState state, IListTypeDecoder listDecoder)
{
Properties result = new();
_ = listDecoder.ReadSize(buffer, state);
int count = listDecoder.ReadCount(buffer, 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.
bool nullValue = buffer.GetByte(buffer.ReadOffset) == (byte)EncodingCodes.Null;
if (nullValue)
{
buffer.ReadByte();
continue;
}
switch (index)
{
case 0:
result.MessageId = state.Decoder.ReadObject(buffer, state);
break;
case 1:
result.UserId = state.Decoder.ReadBinary(buffer, state);
break;
case 2:
result.To = state.Decoder.ReadString(buffer, state);
break;
case 3:
result.Subject = state.Decoder.ReadString(buffer, state);
break;
case 4:
result.ReplyTo = state.Decoder.ReadString(buffer, state);
break;
case 5:
result.CorrelationId = state.Decoder.ReadObject(buffer, state);
break;
case 6:
result.ContentType = state.Decoder.ReadSymbol(buffer, state)?.ToString() ?? null;
break;
case 7:
result.ContentEncoding = state.Decoder.ReadSymbol(buffer, state)?.ToString() ?? null;
break;
case 8:
result.AbsoluteExpiryTime = state.Decoder.ReadTimestamp(buffer, state) ?? 0;
break;
case 9:
result.CreationTime = state.Decoder.ReadTimestamp(buffer, state) ?? 0;
break;
case 10:
result.GroupId = state.Decoder.ReadString(buffer, state);
break;
case 11:
result.GroupSequence = state.Decoder.ReadUnsignedInteger(buffer, state) ?? 0;
break;
case 12:
result.ReplyToGroupId = state.Decoder.ReadString(buffer, state);
break;
}
}
return result;
}