public DataTable Import(string filePath, Configuration configuration) { FileReaderOption option = new FileReaderOption { FilePath = filePath, IsFirstLineHeader = configuration.IsFirstLineHeader }; List <string> lines = _fileReader.Read(option); var table = _mapper.Map(lines, configuration); return(table); }
public List <string> Read(FileReaderOption option) { var lines = new List <string>(); using (StreamReader reader = File.OpenText(option.FilePath)) { string line = null; if (option.IsFirstLineHeader) { line = reader.ReadLine(); } while ((line = reader.ReadLine()) != null) { lines.Add(line); } } return(lines); }