Example #1
0
        /// <summary>
        /// Construct a server by de-serializing its OpcUrl from the stream.
        /// </summary>
        protected TsCHdaTrend(SerializationInfo info, StreamingContext context)
        {
            // deserialize basic parameters.
            Name              = (string)info.GetValue(Names.Name, typeof(string));
            aggregate_        = (int)info.GetValue(Names.AggregateId, typeof(int));
            StartTime         = (TsCHdaTime)info.GetValue(Names.StartTime, typeof(TsCHdaTime));
            EndTime           = (TsCHdaTime)info.GetValue(Names.EndTime, typeof(TsCHdaTime));
            MaxValues         = (int)info.GetValue(Names.MaxValues, typeof(int));
            IncludeBounds     = (bool)info.GetValue(Names.IncludeBounds, typeof(bool));
            resampleInterval_ = (decimal)info.GetValue(Names.ResampleInterval, typeof(decimal));
            updateInterval_   = (decimal)info.GetValue(Names.UpdateInterval, typeof(decimal));
            playbackInterval_ = (decimal)info.GetValue(Names.PlaybackInterval, typeof(decimal));
            playbackDuration_ = (decimal)info.GetValue(Names.PlaybackDuration, typeof(decimal));

            // deserialize timestamps.
            DateTime[] timestamps = (DateTime[])info.GetValue(Names.Timestamps, typeof(DateTime[]));

            if (timestamps != null)
            {
                Array.ForEach(timestamps, timestamp => timeStamps_.Add(timestamp));
            }

            // deserialize items.
            TsCHdaItem[] items = (TsCHdaItem[])info.GetValue(Names.Items, typeof(TsCHdaItem[]));

            if (items != null)
            {
                Array.ForEach(items, item => items_.Add(item));
            }
        }
        /// <summary>
        /// Contructs a server by de-serializing its OpcUrl from the stream.
        /// </summary>
        protected TsCHdaTrend(SerializationInfo info, StreamingContext context)
        {
            // deserialize basic parameters.
            Name              = (string)info.GetValue(Names.NAME, typeof(string));
            _aggregate        = (int)info.GetValue(Names.AGGREGATE_ID, typeof(int));
            StartTime         = (TsCHdaTime)info.GetValue(Names.START_TIME, typeof(TsCHdaTime));
            EndTime           = (TsCHdaTime)info.GetValue(Names.END_TIME, typeof(TsCHdaTime));
            MaxValues         = (int)info.GetValue(Names.MAX_VALUES, typeof(int));
            IncludeBounds     = (bool)info.GetValue(Names.INCLUDE_BOUNDS, typeof(bool));
            _resampleInterval = (decimal)info.GetValue(Names.RESAMPLE_INTERVAL, typeof(decimal));
            _updateInterval   = (decimal)info.GetValue(Names.UPDATE_INTERVAL, typeof(decimal));
            _playbackInterval = (decimal)info.GetValue(Names.PLAYBACK_INTERVAL, typeof(decimal));
            _playbackDuration = (decimal)info.GetValue(Names.PLAYBACK_DURATION, typeof(decimal));

            // deserialize timestamps.
            DateTime[] timestamps = (DateTime[])info.GetValue(Names.TIMESTAMPS, typeof(DateTime[]));

            if (timestamps != null)
            {
                Array.ForEach(timestamps, timestamp => _timeStamps.Add(timestamp));
            }

            // deserialize items.
            TsCHdaItem[] items = (TsCHdaItem[])info.GetValue(Names.ITEMS, typeof(TsCHdaItem[]));

            if (items != null)
            {
                Array.ForEach(items, item => _items.Add(item));
            }
        }