Ejemplo n.º 1
0
        /// <summary>Create a field object.</summary>
        /// <param name="index"></param>
        /// <returns></returns>
        private FieldParser CreateField(int index)
        {
            if (index < 0)
            {
                throw new ElementException(ErrorCode.FieldIndexMustBeZeroOrGreater);
            }

            if (IsMsh)
            {
                if (index == 1)
                {
                    var descendant = new DelimiterFieldParser(this);
                    return(descendant);
                }

                if (index == 2)
                {
                    var descendant = new EncodingFieldParser(this);
                    return(descendant);
                }

                if (index > 2)
                {
                    var descendant = new FieldParser(this, index - 1, index);
                    return(descendant);
                }
            }

            var result = new FieldParser(this, index, index);

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>Create a field object.</summary>
        /// <param name="index"></param>
        /// <returns></returns>
        private FieldParser CreateField(int index)
        {
            if (index < 0)
            {
                throw new ElementException(ErrorCode.FieldIndexMustBeZeroOrGreater);
            }

            if (IsMsh)
            {
                if (index == 1)
                {
                    var descendant = new DelimiterFieldParser(this);
                    return descendant;
                }

                if (index == 2)
                {
                    var descendant = new EncodingFieldParser(this);
                    return descendant;
                }

                if (index > 2)
                {
                    var descendant = new FieldParser(this, index - 1, index);
                    return descendant;
                }
            }

            var result = new FieldParser(this, index, index);
            return result;
        }