Example #1
0
 /// <summary>
 /// The PopulateFields method populates the fields section
 /// of the supplied VFX dictionary with all of the fields
 /// that are found in the supplied XML dictionary.
 /// </summary>
 /// <param name="source">
 /// The source dictionary for the field elements.
 /// </param>
 /// <param name="target">
 /// The target dictionary for the converted elements.
 /// </param>
 private static void PopulateFields(XmlDictionary source, FixDictionary target)
 {
     foreach (XmlFixDxField src in source.Fields.Entries)
     {
         if (src.LengthField == null)
         {
             FixDxField dst = new FixDxField(src.Tag, src.Name, src.Type);
             dst.Enumeration = src.Enumeration;
             target.AddField(dst);
         }
         else
         {
             FixDxField dst = new FixDxField(src.Tag, src.Name, src.Type, src.LengthField);
             dst.Enumeration = src.Enumeration;
             target.AddField(dst);
         }
     }
 }
Example #2
0
        /// <summary>
        /// The Clone method is invoked to construct a completely
        /// new instance/copy of an instance of a dictionary.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FixDictionary result = new FixDictionary();

            // REC: Copy all of the metadata properties into the
            // new instance of the dictionary:
            foreach (string key in _mapProperties.Keys)
            {
                result.Properties.Add(key, _mapProperties[key]);
            }

            // REC: Clone all of the header elements in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement hdrElement in _hdrCollection)
            {
                result.Header.Add(CloneElement(hdrElement));
            }

            // REC: Clone all of the field entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxField dxField in _fldElements)
            {
                result.AddField(CloneField(dxField));
            }

            // REC: Clone all of the block entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxBlock dxBlock in _blkElements)
            {
                result.AddBlock(CloneBlock(dxBlock));
            }

            // REC: Clone all of the message entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxMessage dxMessage in _messages)
            {
                result.AddMessage(CloneMessage(dxMessage));
            }

            // REC: Clone all of the enum entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxEnumeration dxEnumeration in _enmElements)
            {
                result.AddEnumeration(CloneEnumeration(dxEnumeration));
            }

            // REC: Clone all of the trailer entries in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement trlElement in _trlCollection)
            {
                result.Trailer.Add(CloneElement(trlElement));
            }

            return(result);
        }
Example #3
0
        /// <summary>
        /// The Clone method is invoked to construct a completely
        /// new instance/copy of an instance of a dictionary.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FixDictionary result = new FixDictionary();

            // REC: Copy all of the metadata properties into the
            // new instance of the dictionary:
            foreach (string key in _mapProperties.Keys)
            {
                result.Properties.Add(key, _mapProperties[key]);
            }

            // REC: Clone all of the header elements in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement hdrElement in _hdrCollection)
            {
                result.Header.Add(CloneElement(hdrElement));
            }

            // REC: Clone all of the field entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxField dxField in _fldElements)
            {
                result.AddField(CloneField(dxField));
            }

            // REC: Clone all of the block entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxBlock dxBlock in _blkElements)
            {
                result.AddBlock(CloneBlock(dxBlock));
            }

            // REC: Clone all of the message entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxMessage dxMessage in _messages)
            {
                result.AddMessage(CloneMessage(dxMessage));
            }

            // REC: Clone all of the enum entries in this dictionary
            // and add them to the result dictionary:
            foreach (FixDxEnumeration dxEnumeration in _enmElements)
            {
                result.AddEnumeration(CloneEnumeration(dxEnumeration));
            }

            // REC: Clone all of the trailer entries in this dictionary
            // and add them to the result dictionary:
            foreach (IFixDxElement trlElement in _trlCollection)
            {
                result.Trailer.Add(CloneElement(trlElement));
            }

            return result;
        }
Example #4
0
 /// <summary>
 /// The PopulateFields method populates the fields section
 /// of the supplied VFX dictionary with all of the fields
 /// that are found in the supplied XML dictionary.
 /// </summary>
 /// <param name="source">
 /// The source dictionary for the field elements.
 /// </param>
 /// <param name="target">
 /// The target dictionary for the converted elements.
 /// </param>
 private static void PopulateFields(XmlDictionary source, FixDictionary target)
 {
     foreach (XmlFixDxField src in source.Fields.Entries)
     {
         if (src.LengthField == null)
         {
             FixDxField dst = new FixDxField(src.Tag, src.Name, src.Type);
             dst.Enumeration = src.Enumeration;
             target.AddField(dst);
         }
         else
         {
             FixDxField dst = new FixDxField(src.Tag, src.Name, src.Type, src.LengthField);
             dst.Enumeration = src.Enumeration;
             target.AddField(dst);
         }
     }
 }