ParseValues() private method

Parses the given values assuming that they are in the same order as the column definitions.
private ParseValues ( string values ) : object[]
values string The values to parse.
return object[]
示例#1
0
 private object[] parseValues(string[] rawValues)
 {
     try
     {
         return(schema.ParseValues(rawValues));
     }
     catch (FlatFileException exception)
     {
         processError(new RecordProcessingException(recordCount, SharedResources.InvalidRecordConversion, exception));
         return(null);
     }
 }
示例#2
0
 /// <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);
     }
 }
示例#4
0
 /// <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);
 }