/// <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);
            }
        }
Beispiel #2
0
 internal CsvTableRow(CsvTableFile parentFile, string actRowString)
 {
     m_parentFile = parentFile;
     m_rowFields  = actRowString.Split(parentFile.ImporterConfig.SeparationChar);
     m_headerRow  = m_parentFile.CachedHeaderRow;
 }