Ejemplo n.º 1
0
        static AmqpMessageReader()
        {
            MessageSections = new SectionInfo[]
            {
                new SectionInfo(
                    flag: SectionFlag.Header,
                    code: Header.Code,
                    name: Header.Name,
                    ctor: () => new Header(),
                    scanner: (a, b) => ScanListSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.DeliveryAnnotations,
                    code: DeliveryAnnotations.Code,
                    name: DeliveryAnnotations.Name,
                    ctor: () => new DeliveryAnnotations(),
                    scanner: (a, b) => ScanMapSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.MessageAnnotations,
                    code: MessageAnnotations.Code,
                    name: MessageAnnotations.Name,
                    ctor: () => new MessageAnnotations(),
                    scanner: (a, b) => ScanMapSection(a, b)),
                new SectionInfo(flag: SectionFlag.Properties,
                                code: Properties.Code,
                                name: Properties.Name,
                                ctor: () => new Properties(),
                                scanner: (a, b) => ScanListSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.ApplicationProperties,
                    code: ApplicationProperties.Code,
                    name: ApplicationProperties.Name,
                    ctor: () => new ApplicationProperties(),
                    scanner: (a, b) => ScanMapSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.Data,
                    code: Data.Code,
                    name: Data.Name,
                    ctor: () => new Data(),
                    scanner: (a, b) => ScanDataSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.AmqpSequence,
                    code: AmqpSequence.Code,
                    name: AmqpSequence.Name,
                    ctor: () => new AmqpSequence(),
                    scanner: (a, b) => ScanListSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.AmqpValue,
                    code: AmqpValue.Code,
                    name: AmqpValue.Name,
                    ctor: () => new AmqpValue(),
                    scanner: (a, b) => ScanValueSection(a, b)),
                new SectionInfo(
                    flag: SectionFlag.Footer,
                    code: Footer.Code,
                    name: Footer.Name,
                    ctor: () => new Footer(),
                    scanner: (a, b) => ScanMapSection(a, b)),
            };

            for (int i = 0; i < MessageSections.Length; i++)
            {
                SectionInfo info = MessageSections[i];
                AmqpCodec.RegisterKnownTypes(info.Name, info.Code, info.Ctor);
            }
        }
Ejemplo n.º 2
0
        static AmqpMessageReader()
        {
            MessageSections = new SectionInfo[]
            {
                new SectionInfo()
                {
                    Flag    = SectionFlag.Header,
                    Code    = Header.Code,
                    Name    = Header.Name,
                    Ctor    = () => new Header(),
                    Scanner = (a, b) => ScanListSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.DeliveryAnnotations,
                    Code    = DeliveryAnnotations.Code,
                    Name    = DeliveryAnnotations.Name,
                    Ctor    = () => new DeliveryAnnotations(),
                    Scanner = (a, b) => ScanMapSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.MessageAnnotations,
                    Code    = MessageAnnotations.Code,
                    Name    = MessageAnnotations.Name,
                    Ctor    = () => new MessageAnnotations(),
                    Scanner = (a, b) => ScanMapSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.Properties,
                    Code    = Properties.Code,
                    Name    = Properties.Name,
                    Ctor    = () => new Properties(),
                    Scanner = (a, b) => ScanListSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.ApplicationProperties,
                    Code    = ApplicationProperties.Code,
                    Name    = ApplicationProperties.Name,
                    Ctor    = () => new ApplicationProperties(),
                    Scanner = (a, b) => ScanMapSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.Data,
                    Code    = Data.Code,
                    Name    = Data.Name,
                    Ctor    = () => new Data(),
                    Scanner = (a, b) => ScanDataSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.AmqpSequence,
                    Code    = AmqpSequence.Code,
                    Name    = AmqpSequence.Name,
                    Ctor    = () => new AmqpSequence(),
                    Scanner = (a, b) => ScanListSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.AmqpValue,
                    Code    = AmqpValue.Code,
                    Name    = AmqpValue.Name,
                    Ctor    = () => new AmqpValue(),
                    Scanner = (a, b) => ScanValueSection(a, b)
                },
                new SectionInfo()
                {
                    Flag    = SectionFlag.Footer,
                    Code    = Footer.Code,
                    Name    = Footer.Name,
                    Ctor    = () => new Footer(),
                    Scanner = (a, b) => ScanMapSection(a, b)
                },
            };

            for (int i = 0; i < MessageSections.Length; i++)
            {
                SectionInfo info = MessageSections[i];
                AmqpCodec.RegisterKnownTypes(info.Name, info.Code, info.Ctor);
            }
        }