static bool HandleSection()

in src/AmqpMessage.cs [1035:1099]


            static bool HandleSection(AmqpBufferMessage thisPtr, int unused, Section section)
            {
                if (section.Flag == SectionFlag.Header)
                {
                    thisPtr.Header = (Header)section.Value;
                }
                else if (section.Flag == SectionFlag.DeliveryAnnotations)
                {
                    thisPtr.DeliveryAnnotations = (DeliveryAnnotations)section.Value;
                }
                else if (section.Flag == SectionFlag.MessageAnnotations)
                {
                    thisPtr.MessageAnnotations = (MessageAnnotations)section.Value;
                }
                else if (section.Flag == SectionFlag.Properties)
                {
                    thisPtr.Properties = (Properties)section.Value;
                }
                else if (section.Flag == SectionFlag.ApplicationProperties)
                {
                    thisPtr.ApplicationProperties = (ApplicationProperties)section.Value;
                }
                else if (section.Flag == SectionFlag.Data)
                {
                    if (thisPtr.dataList == null)
                    {
                        thisPtr.bodyOffset = section.Offset;
                        thisPtr.dataList = new List<Data>();
                        thisPtr.sectionFlags |= SectionFlag.Data;
                    }

                    thisPtr.bodyLength += section.Length;
                    thisPtr.dataList.Add((Data)section.Value);
                }
                else if (section.Flag == SectionFlag.AmqpSequence)
                {
                    if (thisPtr.sequenceList == null)
                    {
                        thisPtr.bodyOffset = section.Offset;
                        thisPtr.sequenceList = new List<AmqpSequence>();
                        thisPtr.sectionFlags |= SectionFlag.AmqpSequence;
                    }

                    thisPtr.bodyLength += section.Length;
                    thisPtr.sequenceList.Add((AmqpSequence)section.Value);
                }
                else if (section.Flag == SectionFlag.AmqpValue)
                {
                    thisPtr.bodyOffset = section.Offset;
                    thisPtr.bodyLength = section.Length;
                    thisPtr.amqpValue = (AmqpValue)section.Value;
                    thisPtr.sectionFlags |= SectionFlag.AmqpValue;
                }
                else if (section.Flag == SectionFlag.Footer)
                {
                    thisPtr.Footer = (Footer)section.Value;
                }
                else
                {
                    throw new AmqpException(AmqpErrorCode.DecodeError,
                        AmqpResources.GetString(Resources.AmqpInvalidMessageSectionCode, section.Flag));
                }

                return true;
            }