public IEnumerable <ICdlRecord> EnumRows(ArrayDataRecord record) { int page = 0; while (page < _directory.Count) { lock (_directory) { BinaryReader br = new BinaryReader(_cache); _cache.Seek(_directory[page], SeekOrigin.Begin); ChunkInfo info = ChunkInfo.LoadInfo(br); for (int i = 0; i < info.Count; i++) { if (record == null) { yield return(CdlTool.LoadRecord(br, _table)); } else { CdlTool.LoadRecord(br, record); yield return(record); } } } page++; } }
public CdlTable LoadTableData(int start = 0, int?count = null) { lock (_directory) { CdlTable table = new CdlTable(_table); if (count == null) { count = _serializedRows; } if (start >= _serializedRows) { return(table); } int curdic = start / BUFFER_SIZE, skiprec = start % BUFFER_SIZE; _cache.Seek(_directory[curdic], SeekOrigin.Begin); int availtables = _directory.Count - curdic; BinaryReader br = new BinaryReader(_cache); while (table.Rows.Count < count && availtables >= 1) { ChunkInfo info = ChunkInfo.LoadInfo(br); if (skiprec > 0) { int skipbytes = 0; for (int i = 0; i < skiprec; i++) { skipbytes += info.Lengths[i]; } _cache.Seek(skipbytes, SeekOrigin.Current); } int rec = skiprec; while (rec < info.Count) { table.AddRowInternal(CdlTool.LoadRecord(br, _table)); rec++; } availtables--; skiprec = 0; } return(table); } }