Пример #1
0
            internal DataPointCircularQueueDto CreateDto()
            {
                DataPointCircularQueueDto dto = new DataPointCircularQueueDto();

                dto.MaxDataPoints = this.maxSize;
                foreach (DataPoint dataPoint in this.dataPoints)
                {
                    dto.Add(dataPoint.CreateDto());
                }
                return(dto);
            }
Пример #2
0
        private DataPointCircularQueueDto ReadDataPoints(int sequenceNumber)
        {
            DataPointCircularQueueDto dto = new DataPointCircularQueueDto();

            Debug.Assert(this.archiveTemplateIndex.ContainsKey(sequenceNumber));

            dto.MaxDataPoints = this.archiveTemplateIndex[sequenceNumber].MaxDataPoints;

            if (this.reader.IsEmptyElement != true)
            {
                this.reader.Read();

                do
                {
                    this.reader.Read();

                    DataPointDto dataPoint = new DataPointDto();

                    // Value
                    this.reader.ReadStartElement("Value");
                    dataPoint.Value = this.reader.ReadContentAsDouble();
                    this.reader.ReadEndElement();

                    // Timestamp
                    this.reader.ReadStartElement("Timestamp");
                    dataPoint.Timestamp = this.reader.ReadContentAsDateTime();
                    this.reader.ReadEndElement();

                    dto.Add(dataPoint);
                } while (this.reader.ReadToNextSibling("DataPoint"));

                this.reader.ReadEndElement();
            }
            else
            {
                this.reader.Read();
            }

            return(dto);
        }