internal CsvTableRowReader(CsvTableFile parentFile, ResourceLink csvFile) { // Open the csv file for reading m_parentFile = parentFile; m_inStreamReader = CsvUtil.OpenReader(csvFile, parentFile.ImporterConfig); // Read until we reach the starting line for (int loop = 0; loop < m_parentFile.ImporterConfig.FirstValueRowIndex; loop++) { m_inStreamReader.ReadLine(); } }
/// <summary> /// Initializes a new instance of the <see cref="CsvTableFile"/> class. /// </summary> /// <param name="tableFileSource">The file from which to load the table data.</param> /// <param name="importerConfig">The configuration for the import process.</param> internal CsvTableFile(ResourceLink tableFileSource, CsvImporterConfig importerConfig) { m_importerConfig = importerConfig; m_tableFileSource = tableFileSource; using (StreamReader inStreamReader = CsvUtil.OpenReader(tableFileSource, importerConfig)) { // Read until we reach the header row for (int loop = 0; loop < m_importerConfig.HeaderRowIndex; loop++) { inStreamReader.ReadLine(); } // Read the header row and ensure that we have something there string headerRow = inStreamReader.ReadLine(); if (string.IsNullOrEmpty(headerRow)) { throw new SeeingSharpException(string.Format("No header row found in csv file{0}", tableFileSource)); } m_headerRow = new CsvTableHeaderRow(this, headerRow); } }