Exemplo n.º 1
0
        public DataTable ExtractTable(IFormat format)
        {
            SeparatorSeriesFormat separatorSeriesFormat = format as SeparatorSeriesFormat;
            CsvFormat             csvFormat             = format as CsvFormat;

            if (csvFormat != null)
            {
                DataTable result = CsvReader.Read(Location, csvFormat.Separator);
                return(csvFormat.ToFormattedTable(result));
            }
            else if (separatorSeriesFormat != null)
            {
                DataTable result = CsvReader.Read(Location, separatorSeriesFormat.Separator);
                return(separatorSeriesFormat.ToFormattedTable(result));
            }
            else
            {
                throw new NotSupportedException("Format not supported for text files: " + format.GetType());
            }
        }
Exemplo n.º 2
0
        private DataTable Parse(SeparatorSeriesFormat format, string file)
        {
            var rawTable = CsvReader.Read(file, format.Separator);

            return(format.ToFormattedTable(rawTable));
        }