コード例 #1
0
        public void AddData(List <Signal> e)
        {
            if (e != null && e.Count > 0)
            {
                var startT = e.FirstOrDefault().TimeStamps.FirstOrDefault();
                if (FirstFile)
                {
                    TimeZero = startT;
                    //FirstFileRead = true;
                    FirstFile = false;
                }
                //else if (TimeZero >= startT)
                //{
                //    throw new Exception("Possible data source files time order problem.");
                //}
                var endT = e.FirstOrDefault().TimeStamps.LastOrDefault();
                //Console.WriteLine("Added end timestamp: " + endT.ToString("yyyyMMdd_HHmmss.ffffff") + " in " + e.FirstOrDefault().TimeStamps.Count() + " timestamps.");
                foreach (var sig in e)
                {
                    var name = sig.PMUName + "_" + sig.SignalName;

                    lock (_theInputSignalsLock)
                    {
                        if (!Signals.ContainsKey(name))
                        {
                            Signals[name] = new Dictionary <DateTime, Signal>();
                        }
                        Signals[name][endT] = sig;
                    }
                }
                lock (_theDataWriterLock)
                {
                    if (!_doneDataWriterFlags.ContainsKey(endT))
                    {
                        _doneDataWriterFlags[endT] = new List <bool>();
                    }
                    TimePairs[startT] = endT;
                    StartTimeStamps.Add(startT);
                }
                lock (_theEndTimeStampsLock)
                {
                    EndTimeStamps.Add(endT);
                }
            }
        }