Esempio n. 1
0
 /// <summary>
 /// Merges two collections into one.
 /// </summary>
 /// <param name="other">The other collection that should be merged.</param>
 public void MergeCollections(CalendarDates other)
 {
     foreach (var item in other)
     {
         list.Add(item);
     }
     other = null;
 }
Esempio n. 2
0
        /// <summary>
        /// Creates data feed that is required for the application.
        /// </summary>
        /// <param name="path">Path to the folder that will be the feed saved to.</param>
        public void CreateDataFeed(string path)
        {
            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);

            Trips.Write(new StreamWriter(path + "/trips.tfd"));       // This MUST come first because of trip reindexation (based on sorting).
            Stations.Write(new StreamWriter(path + "/stations.tfd")); // This MUST come first because of stations reindexation (based on sorting).

            Calendar.Write(new StreamWriter(path + "/calendar.tfd"));
            CalendarDates.Write(new StreamWriter(path + "/calendar_dates.tfd"));
            RoutesInfo.Write(new StreamWriter(path + "/routes_info.tfd"));
            Stops.Write(new StreamWriter(path + "/stops.tfd"));
            Footpaths.Write(new StreamWriter(path + "/footpaths.tfd"));
            StopTimes.Write(new StreamWriter(path + "/stop_times.tfd"));
            Routes.Write(new StreamWriter(path + "/routes.tfd"));

            using (var expiration = new StreamWriter(path + "/expires.tfd"))
                expiration.Write(ExpirationDate.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
        }