private void Begin(bool headers, CSVFormat format)
{
try
{
DateFormat = "yyyy-MM-dd";
TimeFormat = "hhmmss";
_format = format;
// read the column heads
if (headers)
{
String line = _reader.ReadLine();
IList<String> tok = Parse(line);
int i = 0;
foreach (String header in tok)
{
if (_columns.ContainsKey(header.ToLower()))
throw new EncogError("Two columns cannot have the same name");
_columns.Add(header.ToLower(), i++);
_columnNames.Add(header);
}
}
_data = null;
}
catch (IOException e)
{
#if logging
if (logger.IsErrorEnabled)
{
logger.Error("Exception", e);
}
#endif
throw new EncogError(e);
}
}