Beispiel #1
0
        private Data.Enum ToModel(Xml.Enum xEnum)
        {
            Data.Enum dEnum = new Data.Enum();
            dEnum.XmlDefinition = xEnum;
            string xEnumName = GetName(xEnum);

            dEnum.Name        = xEnumName;
            dEnum.Description = StringHelper.TrimAndNormalizeCarriageReturn(xEnum.Description);
            dEnum.Entries     = ToModels(xEnum.Entries, xEnumName);

            return(dEnum);
        }
Beispiel #2
0
        private IEnumerable <Data.Enum> ToModels(IEnumerable <Xml.Enum> xEnums)
        {
            IList <Data.Enum> dEnums = new List <Data.Enum>();

            foreach (Xml.Enum xEnum in xEnums)
            {
                Data.Enum dEnum = ToModel(xEnum);
                dEnums.Add(dEnum);

                _enumByXmlEnumName.Add(xEnum.Name, dEnum);
            }

            return(dEnums);
        }
Beispiel #3
0
        private Data.MessageFieldType GetFieldType(Xml.MessageField xMessageField)
        {
            MessageFieldDataType dataType = TypeHelper.ToDataType(xMessageField.Type);
            int typeLength = TypeHelper.GetTypeLength(dataType);

            bool isArray = TypeHelper.IsArray(xMessageField.Type);

            if (isArray)
            {
                Int32 arrayLength = TypeHelper.GetArraySize(xMessageField.Type);
                return(new Data.MessageFieldType(dataType, typeLength, arrayLength));
            }

            bool isNotNullEnum = !String.IsNullOrWhiteSpace(xMessageField.Enum);

            if (isNotNullEnum)
            {
                Data.Enum vEnum = _enumByXmlEnumName[xMessageField.Enum];
                return(new Data.MessageFieldType(dataType, typeLength, vEnum));
            }

            return(new Data.MessageFieldType(dataType, typeLength));
        }