Beispiel #1
0
        public virtual void Clear()
        {
            Begin.Clear();
            End.Clear();

            Begin.Next = End;
            End.Prev   = Begin;

            Count = 0;
        }
        public void SetAllStartEndTimesForSpeedModels(string strSource, List <SpeedModel> speedModels)
        {
            DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "Entering SetAllStartEnds");
            //StartTimes
            string strStart, strEnd;

            strStart = "startTimeNanos";
            strEnd   = "endTimeNanos";

            List <int> Start, End;

            if (strSource.Contains(strStart) && strSource.Contains(strEnd))
            {
                Start = strSource.AllIndexesOf(strStart);   //Fill list with all start indexes of the stat word
                End   = strSource.AllIndexesOf(strEnd);     //-""-  for the end word
                List <long> startTimes = new List <long>(); //List that will hold all start times
                string      startTimeString;
                for (int i = 0; i < Start.Count; i++)
                {
                    startTimeString = "";
                    for (int j = Start[i] + strStart.Length + 4; j < End[i] - (strEnd.Length - 1); j++) //Start at the start of start word + length of the word plus some spaces. End at end minus a space
                    {
                        startTimeString += strSource[j];
                    }
                    long parsedStartTime;
                    long.TryParse(startTimeString, out parsedStartTime); //Parse tge start time
                    speedModels[i].startTime = parsedStartTime;          //Set the start time of the correct speed model
                }
                Start.Clear();
                End.Clear(); //Clear them for next session
            }

            //EndTimes
            strEnd   = "dataTypeName";
            strStart = "endTimeNanos";

            if (strSource.Contains(strStart) && strSource.Contains(strEnd))
            {
                Start = strSource.AllIndexesOf(strStart);   //Fill list with all start indexes of the stat word
                End   = strSource.AllIndexesOf(strEnd);     //-""-  for the end word
                List <long> startTimes = new List <long>(); //List that will hold all start times
                string      startTimeString;
                for (int i = 0; i < Start.Count; i++)
                {
                    startTimeString = "";
                    for (int j = Start[i] + strStart.Length + 4; j < End[i] - (strEnd.Length - 1); j++) //Start at the start of start word + length of the word plus some spaces. End at end minus a space
                    {
                        startTimeString += strSource[j];
                    }
                    long parsedStartTime;
                    long.TryParse(startTimeString, out parsedStartTime); //Parse tge start time
                    speedModels[i].endtime = parsedStartTime;            //Set the start time of the correct speed model
                }
            }
        }