예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void Update(DataSourceStatsDto dto)
 {
     Write(dto);
 }
예제 #4
0
 public void Create(DataSourceStatsDto dto)
 {
     SeekEnd();
     Write(dto);
 }