Пример #1
0
        /// <summary>
        /// Extracts a single record from the embedded data.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The value containing the embedded data.</param>
        /// <returns>
        /// An object array containing the values read from the embedded data -or- null if there is no embedded data.
        /// </returns>
        public override object Parse(IColumnContext context, string value)
        {
            if (Preprocessor != null)
            {
                value = Preprocessor(value);
            }
            if (NullHandler.IsNullRepresentation(value))
            {
                return(null);
            }

            var stringReader = new StringReader(value);
            var reader       = new FixedLengthReader(stringReader, schema, Options);

            if (reader.Read())
            {
                return(reader.GetValues());
            }
            return(null);
        }
        /// <summary>
        /// Extracts a single record from the embedded data.
        /// </summary>
        /// <param name="value">The value containing the embedded data.</param>
        /// <returns>
        /// An object array containing the values read from the embedded data -or- null if there is no embedded data.
        /// </returns>
        public override object Parse(string value)
        {
            if (Preprocessor != null)
            {
                value = Preprocessor(value);
            }
            if (NullHandler.IsNullRepresentation(value))
            {
                return null;
            }

            StringReader stringReader = new StringReader(value);
            FixedLengthReader reader = new FixedLengthReader(stringReader, schema, options);
            if (reader.Read())
            {
                return reader.GetValues();
            }
            return null;
        }