private object[] parseValues(string[] rawValues) { try { return(schema.ParseValues(rawValues)); } catch (FlatFileException exception) { processError(new RecordProcessingException(recordCount, SharedResources.InvalidRecordConversion, exception)); return(null); } }
/// <summary> /// Reads the next record from the file. /// </summary> /// <returns>True if the next record was parsed; otherwise, false if all files are read.</returns> public bool Read() { if (hasError) { throw new InvalidOperationException(SharedResources.ReadingWithErrors); } if (parser.EndOfStream) { endOfFile = true; return(false); } string[] rawValues = readNextLine(); values = schema.ParseValues(rawValues); return(true); }
private object[] parseValues(FixedLengthSchema schema, string[] rawValues) { try { var metadata = schemaSelector == null ? this.metadata : new Metadata() { Schema = schema, Options = this.metadata.Options, RecordCount = this.metadata.RecordCount, LogicalRecordCount = this.metadata.LogicalRecordCount }; return(schema.ParseValues(metadata, rawValues)); } catch (FlatFileException exception) { processError(new RecordProcessingException(metadata.RecordCount, Resources.InvalidRecordConversion, exception)); return(null); } }
/// <summary> /// Reads the next record from the file. /// </summary> /// <returns>True if the next record was parsed; otherwise, false if all files are read.</returns> public bool Read() { if (isDisposed) { throw new ObjectDisposedException("FixedLengthParser"); } if (hasError) { throw new InvalidOperationException(Resources.ReadingWithErrors); } if (reader.EndOfStream) { endOfFile = true; return(false); } ++recordCount; string[] rawValues = readNextLine(); values = schema.ParseValues(rawValues); return(true); }