Beispiel #1
0
        private ArrayList ReadData(StreamReader reader)
        {
            ArrayList a = new ArrayList();

            using (var csv = new CsvReader(reader))
            {
                csv.Configuration.Delimiter = ";";

                var         records    = csv.GetRecords <TamCSVRealTime>();
                IEnumerator enumerator = records.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    object         item = enumerator.Current;
                    TamCSVRealTime t    = (TamCSVRealTime)item;
                    a.Add(t);
                }
            }

            return(a);
        }
Beispiel #2
0
        public ArrayList CreateShedules(ArrayList table)
        {
            schedules = new ArrayList();

            for (int i = 0; i < table.Count; i += 3)
            {
                TamSchedule    tamSchedule = new TamSchedule();
                TamCSVRealTime t1          = (TamCSVRealTime)table[i];
                TamCSVRealTime t2          = (TamCSVRealTime)table[i + 1];
                TamCSVRealTime t3          = (TamCSVRealTime)table[i + 2];

                tamSchedule.TramStop = t1.stop_name;

                tamSchedule.NextTrams.Add(new DestinationToTime(t1.trip_headsign, t1.departure_time));
                tamSchedule.NextTrams.Add(new DestinationToTime(t2.trip_headsign, t2.departure_time));
                tamSchedule.NextTrams.Add(new DestinationToTime(t3.trip_headsign, t3.departure_time));

                schedules.Add(tamSchedule);
            }

            return(schedules);
        }