Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private ISOMessageTypesPackager LoadMessageTypes(XmlReader reader)
        {
            ISOMessageTypesPackager msgTypesPackager = new ISOMessageTypesPackager(_logger, m_totalFields);

            if (reader.ReadToDescendant("message"))
            {
                do
                {
                    ISOMsgTypePackager msgTypeDefinition = new ISOMsgTypePackager(_logger, m_totalFields);

                    // Search for the attribute name on this current node.

                    string attribute = reader["type"];

                    if (attribute != null)
                    {
                        msgTypeDefinition.messageTypeIdentifier = attribute;
                    }

                    attribute = reader["name"];

                    if (attribute != null)
                    {
                        msgTypeDefinition.messageTypeName = attribute;
                    }

                    attribute = reader["desc"];

                    if (attribute != null)
                    {
                        msgTypeDefinition.messageTypeDescription = attribute;
                    }

                    // read the rest of attributes from 0 to total_dialect fields

                    for (int field = 0; field <= m_totalFields; ++field)
                    {
                        string attributeName = "f" + field.ToString("D3");

                        attribute = reader[attributeName];

                        switch (attribute)
                        {
                        case "C":
                            msgTypeDefinition.m_conBitmap.SetBit(field);
                            break;

                        case "M":
                            msgTypeDefinition.m_manBitmap.SetBit(field);
                            break;

                        case "O":
                            msgTypeDefinition.m_optBitmap.SetBit(field);
                            break;

                        default:
                            msgTypeDefinition.m_manBitmap.SetBit(field);

                            msgTypeDefinition.m_optBitmap.SetBit(field);
                            break;
                        }
                    }

                    msgTypesPackager.Add(msgTypeDefinition.messageTypeIdentifier, msgTypeDefinition);
                } while (reader.ReadToNextSibling("message"));
            }

            return(msgTypesPackager);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="msgType"></param>
 /// <param name="msgTypePackager"></param>
 public void Add(string msgType, ISOMsgTypePackager msgTypePackager)
 {
     m_msgTypes.Add(msgType, msgTypePackager);
 }