예제 #1
0
        /// <summary>
        /// Processes the segment.
        /// Loops through all of the fields within the segment, and parsing them individually.
        /// </summary>
        /// <param name="segment">The segment.</param>
        /// <param name="parentNode">The parent node.</param>
        private static void ProcessSegmentNew(AbstractSegment segment, FieldGroup parentNode)
        {
            FieldGroup segmentNode = new FieldGroup()
            {
                Name = segment.GetStructureName(), Id = segment.GetStructureName()
            };
            int dataItemCount = 0;

            for (int i = 1; i <= segment.NumFields(); i++)
            {
                dataItemCount++;
                IType[] dataItems = segment.GetField(i);
                foreach (IType item in dataItems)
                {
                    ProcessFieldNew(item, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }

                if (dataItems.Count() == 0 && segmentNode.FieldList.Count > 0)
                {
                    AbstractPrimitive msg = null;
                    ProcessPrimitiveFieldNew((AbstractPrimitive)msg, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }
            }

            AddChildGroupNew(parentNode, segmentNode);
        }
예제 #2
0
        /// <summary>
        /// Processes the segment.
        /// Loops through all of the fields within the segment, and parsing them individually.
        /// </summary>
        /// <param name="segment">The segment.</param>
        /// <param name="parentNode">The parent node.</param>
        private static void ProcessSegment(AbstractSegment segment, FieldGroup parentNode)
        {
            FieldGroup segmentNode = new FieldGroup()
            {
                Name = segment.GetStructureName(), Id = segment.GetStructureName()
            };
            int dataItemCount = 0;

            for (int i = 1; i <= segment.NumFields(); i++)
            {
                dataItemCount++;
                IType[] dataItems = segment.GetField(i);
                foreach (IType item in dataItems)
                {
                    ProcessField(item, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }
            }

            AddChildGroup(parentNode, segmentNode);
        }