Пример #1
0
        /// <summary>
        /// Read the records from csv file.
        /// </summary>
        /// <param name="reader">The csv reader.</param>
        public void LoadFromCsv(StreamReader reader)
        {
            if (reader is null)
            {
                throw new ArgumentNullException($"{nameof(reader)} cannot be null.");
            }

            using var csvReader = new FileCabinetRecordCsvReader(reader);
            this.records        = csvReader.Read().ToArray();
        }
        /// <summary>
        /// Loads from CSV.
        /// </summary>
        /// <param name="stream">The stream.</param>
        public void LoadFromCsv(StreamReader stream)
        {
            FileCabinetRecordCsvReader csvReader = new FileCabinetRecordCsvReader(stream);

            this.Records = new ReadOnlyCollection <FileCabinetRecord>(csvReader.ReadAll());
        }
        /// <summary>
        /// Loads from CSV.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="validator">The validator.</param>
        /// <param name="converter">The converter.</param>
        /// <param name="modelWriter">console writer.</param>
        public void LoadFromCsv(StreamReader reader, IRecordValidator validator, Converter converter, ModelWriters modelWriter)
        {
            FileCabinetRecordCsvReader csvReader = new FileCabinetRecordCsvReader(reader, validator, converter, modelWriter);

            this.ReadRecords = csvReader.ReadAll();
        }