コード例 #1
0
        private void CreateAttributes(DataSourceDto dto)
        {
            this.name = dto.Name;

            Writer.Seek(0, SeekOrigin.End);
            this.fixup.FixupPosition = Writer.BaseStream.Position;
            Writer.Write(dto.ConversionFunction);
            Writer.Write(Convert.ToInt32(dto.PollingInterval.TotalSeconds));
            if (this.lastReadingDao == null)
            {
                this.lastReadingDao = new BinaryFileReadingDao(this);
            }
            ReadingDto lastReadingDto;

            if (dto.LastReading != null)
            {
                lastReadingDto = dto.LastReading;
            }
            else
            {
                lastReadingDto       = new ReadingDto();
                lastReadingDto.Empty = true;
            }
            this.lastReadingDao.Create(lastReadingDto);
            if (this.rangeDao == null)
            {
                this.rangeDao = new BinaryFileRangeDao(this);
            }
            this.rangeDao.Create(dto.Range);
        }
コード例 #2
0
 private void ReadAttributes()
 {
     this.name = this.dto.Name = this.fixup.Name;
     this.dto.ConversionFunction = Reader.ReadInt32();
     this.dto.PollingInterval    = new TimeSpan(0, 0, Reader.ReadInt32());
     if (this.lastReadingDao == null)
     {
         this.lastReadingDao = new BinaryFileReadingDao(this);
     }
     this.dto.LastReading = this.lastReadingDao.Read();
     if (this.rangeDao == null)
     {
         this.rangeDao = new BinaryFileRangeDao(this);
     }
     this.dto.Range = this.rangeDao.Read();
 }