public IDictionary<string, IList<Array>> Import()
{
using var streamReader = new StreamReader(Filepath);
var Config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
Delimiter = ",",
IgnoreBlankLines = false,
TrimOptions = TrimOptions.Trim,
HasHeaderRecord = checkHeader(streamReader) // bool that just checks if the first line is a header
Mode = CsvMode.NoEscape,
};
using var dataReader = new dataReader(streamReader, Config);
var getLines = dataReader.GetRecords<DataObj>(); // all the data is kept as a string, exists for easier assigning/indexing of the columns
int lineCounter = 0;
foreach (var line in getLines)
{
lineCount++;
var goodData = CheckData.Validate(line, lineCount); // bunch of if statements just ensuring the data fits within parameters, returns the good data in an array or null, otherwise
if (validatedClaim != null)
{
AddDataToDict(goodData.Factor1, goodDataArray!); // Adds good data to a dictionary, each value is a list, where the arrays returned from check data are appended
}
}
return _dataDict;
}
public IDictionary<string, IList<Array>> Import()
{
using var streamReader = new StreamReader(Filepath);
var Config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
Delimiter = ",",
IgnoreBlankLines = false,
TrimOptions = TrimOptions.Trim,
HasHeaderRecord = checkHeader(streamReader) // bool that just checks if the first line is a header
Mode = CsvMode.NoEscape,
};
using var dataReader = new dataReader(streamReader, Config);
var getLines = dataReader.GetRecords<DataObj>(); // all the data is kept as a string, exists for easier assigning/indexing of the columns
int lineCounter = 0;
foreach (var line in getLines)
{
lineCount++;
var goodData = CheckData.Validate(line, lineCount); // bunch of if statements just ensuring the data fits within parameters, returns the good data in an array or null, otherwise
if (validatedClaim != null)
{
AddDataToDict(goodData.Factor1, goodDataArray!); // Adds good data to a dictionary, each value is a list, where the arrays returned from check data are appended
}
}
return _dataDict;
}