Пример #1
0
        public IEnumerable <CredicoopRecord> ReadTransactionsCredicoop()
        {
            var delimiter = new ParserDelimiter(File.ReadAllLines(_file).FirstOrDefault());
            var separator = delimiter.GetBestCharDelimiter();
            var csv       = new CsvReader(File.OpenText(_file));

            csv.Configuration.Delimiter       = $"{separator}";
            csv.Configuration.HasHeaderRecord = true;
            csv.Configuration.HeaderValidated = null;
            csv.Configuration.RegisterClassMap <CredicoopRecordMap>();
            var results = csv.GetRecords <CredicoopRecord>().ToArray();

            return(results);
        }
Пример #2
0
        public IEnumerable <FrancesRecord> ReadTransactionsFrances()
        {
            var delimiter = new ParserDelimiter(File.ReadLines(_file).FirstOrDefault());
            var separator = delimiter.GetBestCharDelimiter();

            List <string> linesFile = File.ReadAllLines(_file).ToList();

            linesFile.RemoveRange(0, 6);
            File.WriteAllLines(AuxiliarFileFrances, linesFile.ToArray());

            var csv = new CsvReader(File.OpenText(AuxiliarFileFrances));

            csv.Configuration.Delimiter       = $"{separator}";
            csv.Configuration.HasHeaderRecord = true;
            csv.Configuration.HeaderValidated = null;
            csv.Configuration.RegisterClassMap <FrancesRecordMap>();
            var results = csv.GetRecords <FrancesRecord>().ToArray();

            return(results);
        }