public IEnumerable <T> ReadFieldDataRows <T>(RowReader <T> reader, string fileName, FieldMapperReading <T> fm, List <int> charLengths) where T : class, new() { var firstRow = true; try { while (Cs.ReadRow(Row, charLengths)) { if ((Row.Count == 1) && ((Row[0].Value == null) || (string.IsNullOrEmpty(Row[0].Value.Trim())))) { continue; } var readingResult = reader.ReadingOneFieldRow(fm, Row, firstRow); if (readingResult) { yield return(reader.Obj); } firstRow = false; } } finally { if (!string.IsNullOrEmpty(fileName)) { _stream.Close(); } Ae.ThrowIfExceptionsStored(); } }
public IEnumerable <T> ReadRawData <T>(RowReader <T> reader, string fileName) where T : class, new() { bool firstRow = true; try { while (Cs.ReadRow(Row)) { if ((Row.Count == 1) && ((Row[0].Value == null) || (string.IsNullOrEmpty(Row[0].Value.Trim())))) { continue; } bool readingResult = reader.ReadingOneRawRow(Row, firstRow); if (readingResult) { yield return(reader.Obj); } firstRow = false; } } finally { if (!string.IsNullOrEmpty(fileName)) { _stream.Close(); } Ae.ThrowIfExceptionsStored(); } }
public IEnumerable <T> ReadFieldData <T>(RowReader <T> reader, string fileName) where T : class, new() { var fm = new FieldMapperReading <T>(FileDescription, fileName, false); var charLengths = fm.GetCharLengths(); return(ReadFieldDataRows(reader, fileName, fm, charLengths)); }
public IEnumerable <T> ReadData <T>(string fileName) where T : class, new() { RowReader <T> reader = ReadDataPreparation <T>(fileName); if (typeof(IDataRow).IsAssignableFrom(typeof(T))) { Row = new T() as IDataRow; return(ReadRawData(reader, fileName)); } Row = new DataRow(); return(ReadFieldData(reader, fileName)); }