private void Write(DataSourceStatsDto dto) { if (Position == BinaryFileDao.UnknownOffset) { // Record where the stats has been read from Position = Writer.BaseStream.Position; } else { // Go to the location of the stats in the file Writer.BaseStream.Seek((int)Position, SeekOrigin.Begin); } Writer.Write(dto.Total); Writer.Write(dto.Discarded); dto.Dao = this; }
public DataSourceStatsDto Read() { if (Position != BinaryFileDao.UnknownOffset) { Reader.BaseStream.Seek(Position, SeekOrigin.Begin); } else { // Save the position of the state information Position = Reader.BaseStream.Position; } DataSourceStatsDto dto = new DataSourceStatsDto(); dto.Total = Reader.ReadInt64(); dto.Discarded = Reader.ReadInt64(); dto.Dao = this; return(dto); }
public void Update(DataSourceStatsDto dto) { Write(dto); }
public void Create(DataSourceStatsDto dto) { SeekEnd(); Write(dto); }