public override void Open() { object dataSource = base.DataSource; this.fileSource = dataSource as CsvFileSource; if ((this.fileSource != null) && (this.fileSource.FileStream != null)) { try { Encoding encoding = this.fileSource.Encoding; if (encoding == null) { encoding = Encoding.UTF8; } string data = new StreamReader(this.fileSource.FileStream, encoding, true).ReadToEnd(); this.cachedFileText = CsvImp.ParseText(data, this.fileSource.RowDelimiter, this.fileSource.ColumnDelimiter, this.fileSource.CellDelimiter); this.hasRowHeader = (this.fileSource.OpenFlags & TextFileOpenFlags.IncludeRowHeader) == TextFileOpenFlags.IncludeRowHeader; this.hasColumnHeader = (this.fileSource.OpenFlags & TextFileOpenFlags.IncludeColumnHeader) == TextFileOpenFlags.IncludeColumnHeader; base.Open(); if ((this.cachedFileText != null) && (this.cachedFileText.Count > 0)) { this.CreateDataFields(); } } catch { } } }
public void ReOpen() { object dataSource = base.DataSource; this.fileSource = dataSource as CsvFileSource; if (((this.fileSource != null) && (this.fileSource.FileStream != null)) && (this.fileSource.FileStream.CanRead && this.fileSource.FileStream.CanSeek)) { if (this.fileSource.FileStream.CanSeek) { this.fileSource.FileStream.Seek(0L, (SeekOrigin)SeekOrigin.Begin); } this.Open(); } }