Пример #1
0
        public void ReadDataFromAFile()
        {
            string   fileName = @"c:\temp\Tulsa Bank 1 LTC 1.d2";
            DateTime start    = DateTime.Parse("4/17/2013 10:38 AM");
            DateTime stop     = DateTime.Parse("4/17/2013 10:38 AM");

            HistorianKey   key   = new HistorianKey();
            HistorianValue value = new HistorianValue();

            using (SortedTreeFile file = SortedTreeFile.OpenFile(fileName, isReadOnly: true))
                using (SortedTreeTable <HistorianKey, HistorianValue> table = file.OpenTable <HistorianKey, HistorianValue>())
                    using (SortedTreeTableReadSnapshot <HistorianKey, HistorianValue> snapshot = table.BeginRead())
                    {
                        SortedTreeScannerBase <HistorianKey, HistorianValue> scanner = snapshot.GetTreeScanner();
                        HistorianKey seekKey = new HistorianKey();
                        seekKey.TimestampAsDate = start;
                        seekKey.PointID         = 3142023;
                        scanner.SeekToKey(seekKey);
                        while (scanner.Read(key, value) && key.TimestampAsDate <= stop)
                        {
                            Console.WriteLine("{0}, {1}, {2}",
                                              key.TimestampAsDate.ToString(), key.PointID, value.AsString);
                        }
                    }
        }
 public void SeekToKeyAndUpdateCacheValue(TKey key)
 {
     Scanner.SeekToKey(key);
     CacheIsValid = Scanner.Peek(CacheKey, CacheValue);
 }