Beispiel #1
0
        /// <summary>
        /// The ExportBlocks method is invoked to convert all of
        /// the block elements in an instance of a VersaFix data
        /// dictionary into corresponding entries in an instance
        /// of an XML representation of a QuickFix dictionary.
        /// </summary>
        /// <param name="src">
        /// The source dictionary for the block definitions.
        /// </param>
        /// <param name="dst">
        /// The target dictionary for the block definitions.
        /// </param>
        private void ExportBlocks(FixDictionary src, XmlQfxDictionary dst)
        {
            foreach (IFixDxElement dxElement in src.Blocks)
            {
                FixDxBlock dxBlock = dxElement as FixDxBlock;
                if (dxBlock != null)
                {
                    XmlQfxBlock xmlBlock = new XmlQfxBlock();
                    xmlBlock.Name = dxBlock.Name;
                    foreach (IFixDxElement dxBlockElement in dxBlock.Elements)
                    {
                        ExportElement(dxBlockElement, xmlBlock.Elements);
                    }

                    dst.Blocks.Add(xmlBlock);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// The PopulateBlocks method is invoked to convert all of the
        /// component block definitions in a QuickFix dictionary into
        /// corresponding component block definitions in an instance of
        /// a VersaFix dictionary.
        /// </summary>
        /// <param name="src">
        /// The QuickFix dictionary to copy the blocks from.
        /// </param>
        /// <param name="dst">
        /// The VersaFix dictionary to copy the blocks into.
        /// </param>
        private void PopulateBlocks(XmlQfxDictionary src, FixDictionary dst)
        {
            foreach (object block in src.Blocks)
            {
                XmlQfxBlock xmlBlock = block as XmlQfxBlock;
                if (xmlBlock != null)
                {
                    if (!string.IsNullOrEmpty(xmlBlock.Name))
                    {
                        FixDxBlock dxBlock = new FixDxBlock(xmlBlock.Name);
                        foreach (object element in xmlBlock.Elements)
                        {
                            IFixDxElement dxElement = ConvertElement(element);
                            if (dxElement != null)
                            {
                                dxBlock.Elements.Add(dxElement);
                            }
                        }

                        dst.Blocks.Add(dxBlock);
                    }
                }
            }
        }