Пример #1
0
        private string GetName(Xml.Message xMessage)
        {
            if (_messageNameTransformation == null)
            {
                return(xMessage.Name);
            }

            return(_messageNameTransformation.Transform(xMessage));
        }
Пример #2
0
        private static Xml.Message ToMessage(XElement xElement)
        {
            Xml.Message message = new Xml.Message();
            message.Id          = Int32.Parse(xElement.Attribute("id").Value);
            message.Name        = xElement.Attribute("name")?.Value;
            message.Description = xElement.Element(XName.Get("description"))?.Value;

            IEnumerable <MessageField> fields = GetMessageFields(xElement);

            message.Fields = fields;

            return(message);
        }
Пример #3
0
        private Data.Message ToModel(Xml.Message xMessage)
        {
            Data.Message dMessage = new Data.Message();
            dMessage.XmlDefinition = xMessage;
            dMessage.Id            = xMessage.Id;
            dMessage.Name          = GetName(xMessage);
            dMessage.Description   = StringHelper.TrimAndNormalizeCarriageReturn(xMessage.Description);

            IEnumerable <Xml.MessageField> filteredMessageFields = _includeExtensionFields ? xMessage.Fields : xMessage.Fields.Where(f => !f.IsExtension);

            dMessage.Fields   = ToModels(filteredMessageFields);
            dMessage.CrcExtra = MessageCrcHelper.GetExtraCrc(xMessage.Name, filteredMessageFields);
            return(dMessage);
        }