private IEnumerable <IDataPoint> ReadDataStream(TreeStream <HistorianKey, HistorianValue> stream) { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); List <ArchiveDataPoint> queriedData = new List <ArchiveDataPoint>(); ArchiveDataPoint point; MeasurementStateFlags stateFlags; while (stream.Read(key, value)) { point = new ArchiveDataPoint((int)key.PointID); point.Time = new TimeTag(new DateTime((long)key.Timestamp)); point.Value = BitConvert.ToSingle(value.Value1); stateFlags = (MeasurementStateFlags)value.Value3; if ((stateFlags & MeasurementStateFlags.BadData) == 0) { if ((stateFlags & MeasurementStateFlags.BadTime) == 0) { point.Quality = Quality.Good; } else { point.Quality = Quality.Old; } } else { point.Quality = Quality.SuspectData; } queriedData.Add(point); } return(queriedData); }