in src/AmqpCodec.cs [1243:1277]
public static AmqpDescribed CreateAmqpDescribed(
ByteBuffer buffer,
Dictionary<string, Func<AmqpDescribed>> byName,
Dictionary<ulong, Func<AmqpDescribed>> byCode)
{
FormatCode formatCode = AmqpEncoding.ReadFormatCode(buffer);
if (formatCode == FormatCode.Null)
{
return null;
}
AmqpEncoding.VerifyFormatCode(formatCode, buffer.Offset, FormatCode.Described);
Func<AmqpDescribed> knownTypeCtor = null;
formatCode = AmqpEncoding.ReadFormatCode(buffer);
if (formatCode == FormatCode.Symbol8 || formatCode == FormatCode.Symbol32)
{
AmqpSymbol name = SymbolEncoding.Decode(buffer, formatCode);
byName.TryGetValue(name.Value, out knownTypeCtor);
}
else if (formatCode == FormatCode.ULong0 || formatCode == FormatCode.ULong || formatCode == FormatCode.SmallULong)
{
ulong code = ULongEncoding.Decode(buffer, formatCode);
byCode.TryGetValue(code, out knownTypeCtor);
}
if (knownTypeCtor == null)
{
throw AmqpEncoding.GetEncodingException(AmqpResources.GetString(AmqpResources.AmqpInvalidFormatCode, formatCode, buffer.Offset));
}
AmqpDescribed value = knownTypeCtor();
return value;
}