protected override Task <bool> LoadData() { var files = _fileSystem.GetFiles(_loadPath, _extension); _dataTables.Clear(); foreach (var file in files) { using (var stream = _fileSystem.OpenRead(file)) using (var reader = new StreamReader(stream)) { var csv = new CsvReader(reader); var table = new CsvTable(); while (csv.Read()) { var row = table.AddRow(); for (int i = 0; i < csv.FieldsCount; ++i) { row.Add(csv[i]); } } _dataTables[Path.GetFileNameWithoutExtension(file)] = table; } } return(Task.FromResult(true)); }
public Task <bool> Load() { var files = Directory.GetFiles(_loadPath, _searchPattern); _dataTables = new Dictionary <string, CsvTable>(); foreach (var file in files) { using (var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var reader = new StreamReader(stream)) { var csv = new CsvReader(reader); var table = new CsvTable(); while (csv.Read()) { var row = table.AddRow(); for (int i = 0; i < csv.FieldsCount; ++i) { row.Add(csv[i]); } } _dataTables[Path.GetFileNameWithoutExtension(file)] = table; } } return(Task.FromResult(true)); }
public void SetCell(int col, int row, string data) { for (int i = _table.Count; i <= row; ++i) { _table.AddRow(); } for (int i = _table[row].Count; i <= col; ++i) { _table[row].Add(null); } _table[row][col] = data; }