Пример #1
0
        public DataPointDto Read()
        {
            if (Position != BinaryFileDao.UnknownOffset)
            {
                Reader.BaseStream.Seek(Position, SeekOrigin.Begin);
            }
            else
            {
                // Save the position of the state information
                Position = Reader.BaseStream.Position;
            }

            DataPointDto dto = new DataPointDto();

            dto.Dao = this;

            dto.Empty = Reader.ReadBoolean();
            if (this.timestampDao == null)
            {
                this.timestampDao = new BinaryFileDateTimeDao(this);
            }
            dto.Timestamp = this.timestampDao.Read();
            dto.Value     = Reader.ReadDouble();

            return(dto);
        }
Пример #2
0
 private void WriteAttributes(ArchiveDto archiveDto)
 {
     if (this.slotExpiryTimeDao == null)
     {
         this.slotExpiryTimeDao = new BinaryFileDateTimeDao(this);
     }
     this.slotExpiryTimeDao.Create(archiveDto.SlotExpiryTime);
 }
        private void WriteAttributes()
        {
            // Title
            if (this.titleDao == null)
            {
                this.titleDao = new BinaryFileStringDao(this, TimeSeriesDatabase.MaxTitleLength);
            }
            this.titleDao.Create(this.dto.Title);

            // Start time
            if (this.startTimeDao == null)
            {
                this.startTimeDao = new BinaryFileDateTimeDao(this);
            }
            this.startTimeDao.Create(this.dto.StartTime);
        }
Пример #4
0
        private void ReadAttributes()
        {
            if (Position != BinaryFileDao.UnknownOffset)
            {
                Reader.BaseStream.Seek(Position, SeekOrigin.Begin);
            }
            else
            {
                // Save the position of the attribute information
                Position = Reader.BaseStream.Position;
            }

            if (this.slotExpiryTimeDao == null)
            {
                this.slotExpiryTimeDao = new BinaryFileDateTimeDao(this);
            }
            this.dto.SlotExpiryTime = this.slotExpiryTimeDao.Read();
        }
Пример #5
0
        private void Write(ReadingDto dto)
        {
            if (Position == BinaryFileDao.UnknownOffset)
            {
                // Record where the reading has been read from
                Position = Writer.BaseStream.Position;
            }
            else
            {
                // Go to the location of the reading in the file
                Writer.BaseStream.Seek((int)Position, SeekOrigin.Begin);
            }

            Writer.Write(dto.Empty);
            if (this.timestampDao == null)
            {
                this.timestampDao = new BinaryFileDateTimeDao(this);
            }
            this.timestampDao.Create(dto.Timestamp);
            Writer.Write(dto.Value);
        }
Пример #6
0
        public void Write(DataPointDto dto)
        {
            if (Position == BinaryFileDao.UnknownOffset)
            {
                Writer.Seek(0, SeekOrigin.End);
                // Record where the data point has been written
                Position = Writer.BaseStream.Position;
            }
            else
            {
                // Go to the location of the datum in the file
                Writer.BaseStream.Seek((int)Position, SeekOrigin.Begin);
            }

            Writer.Write(dto.Empty);
            if (this.timestampDao == null)
            {
                this.timestampDao = new BinaryFileDateTimeDao(this);
            }
            this.timestampDao.Create(dto.Timestamp);
            Writer.Write(dto.Value);
        }