Ejemplo n.º 1
0
        private void LoadMessages()
        {
            XElement xe = fixml.Root.Element("messages");

            foreach (XElement message in xe.Elements())
            {
                string name    = message.Attribute("name").Value;
                string msgtype = message.Attribute("msgtype").Value;
                string msgcat  = message.Attribute("msgcat").Value;

                Console.WriteLine("Processing: {0}", name);

                Message fixmessage = new Message(name, msgtype, msgcat);

                foreach (XElement mo in message.Elements())
                {
                    if (mo.Name == "field")
                    {
                        string fieldname = mo.Attribute("name").Value;
                        bool   required  = false;
                        if (mo.Attribute("required").Value == "Y")
                        {
                            required = true;
                        }

                        MessageField mf = new MessageField(fieldname, required);
                        fixmessage.AddMessageObject(mf);
                    }
                    else if (mo.Name == "group")
                    {
                        fixmessage.AddMessageObject(RecurseGroup(mo));
                    }
                }

                Messages.Instance.AddMessage(fixmessage);
            }
        }
Ejemplo n.º 2
0
        public void AddMessageField(string name, bool required)
        {
            MessageField mf = new MessageField(name, required);

            _fields.Add(mf);
        }