public static void FormatRoutes(List <Tuple <BusRoute, string[], string[]> > routes, CompactFormatWriter writer)
 {
     for (int i = 0; i < routes.Count; i++)
     {
         var route = routes[i];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteQuotedString(route.Item1.Description);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
 public static void FormatAgencies(List <Tuple <TransitAgency, string[]> > agencies, CompactFormatWriter writer)
 {
     for (int i = 0; i < agencies.Count; i++)
     {
         var agency = agencies[i];
         writer.WriteString(agency.Item1.ID);
         writer.WriteQuotedString(agency.Item1.Name);
         writer.WriteQuotedString(agency.Item1.Url);
         writer.OpenParens();
         foreach (var route in agency.Item2)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Exemplo n.º 3
0
 public void Format(CompactFormatWriter formatter)
 {
     for (int i = 0; i < DaySchedules.Count; i++)
     {
         formatter.WriteInt((int)Days[i]);
         formatter.WriteInt((int)TechnicalDays[i]);
         formatter.OpenParens();
         DaySchedules[i].Format(formatter);
         formatter.CloseParens();
         formatter.NextItem();
     }
 }
 public static void FormatStops(List <BusStop> stops, CompactFormatWriter writer)
 {
     for (int i = 0; i < stops.Count; i++)
     {
         var stop = stops[i];
         writer.WriteString(stop.ID);
         writer.WriteInt((int)stop.Direction);
         writer.WriteString(stop.Position.Latitude.ToString());
         writer.WriteString(stop.Position.Longitude.ToString());
         writer.WriteQuotedString(stop.Name);
         writer.WriteString(stop.Code);
         writer.WriteInt(stop.LocationType);
         writer.OpenParens();
         foreach (var route in stop.Routes)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Exemplo n.º 5
0
        public void Format(CompactFormatWriter formatter)
        {
            string curRoute = "";

            foreach (var item in Data)
            {
                if (curRoute == "")
                {
                    curRoute = item.Item1;
                    formatter.WriteString(curRoute);
                    formatter.OpenParens();
                }
                else if (item.Item1 != curRoute)
                {
                    curRoute = item.Item1;
                    formatter.CloseParens();
                    formatter.NextItem();
                    formatter.WriteString(curRoute);
                    formatter.OpenParens();
                }
                formatter.WriteQuotedString(item.Item2);
                formatter.OpenParens();
                foreach (var subItem in item.Item3)
                {
                    formatter.WriteInt(subItem.Item1);
                    formatter.WriteString(subItem.Item2);
                    if (subItem.Item3 != null)
                    {
                        formatter.WriteInt(subItem.Item3.Value);
                    }
                    formatter.NextItem();
                }
                formatter.CloseParens();
                formatter.NextItem();
            }
            formatter.CloseParens();
        }
Exemplo n.º 6
0
        public static async Task SavePendingDownloads()
        {
            CompactFormatWriter writer = new CompactFormatWriter();

            foreach (var route in PendingDownloadsCache)
            {
                foreach (var item in route)
                {
                    writer.WriteString(item);
                }
                writer.NextItem();
            }
            var file = await ApplicationData.Current.LocalCacheFolder.GetFileAsync("PendingDownloadsCache.txt");

            await FileIO.WriteTextAsync(file, writer.ToString());
        }
Exemplo n.º 7
0
 public static void FormatAgencies(List<Tuple<TransitAgency, string[]>> agencies, CompactFormatWriter writer)
 {
     while (agencies.Count > 0)
     {
         var agency = agencies[0];
         writer.WriteString(agency.Item1.ID);
         writer.WriteQuotedString(agency.Item1.Name);
         writer.WriteQuotedString(agency.Item1.Url);
         writer.OpenParens();
         foreach (var route in agency.Item2)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
         agencies.RemoveAt(0);
     }
 }
Exemplo n.º 8
0
 public static void FormatRoutes(List<Tuple<BusRoute, string[], string[]>> routes, CompactFormatWriter writer)
 {
     while (routes.Count > 0)
     {
         var route = routes[0];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteString(route.Item1.ID);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
         routes.RemoveAt(0);
     }
 }
Exemplo n.º 9
0
 public static void FormatStops(List<BusStop> stops, CompactFormatWriter writer)
 {
     for (int i = 0; i < stops.Count; i++)
     {
         var stop = stops[i];
         writer.WriteString(stop.ID);
         writer.WriteInt((int)stop.Direction);
         writer.WriteString(stop.Position.Latitude.ToString());
         writer.WriteString(stop.Position.Longitude.ToString());
         writer.WriteQuotedString(stop.Name);
         writer.WriteString(stop.Code);
         writer.WriteInt(stop.LocationType);
         writer.OpenParens();
         foreach (var route in stop.Routes)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Exemplo n.º 10
0
 public static void FormatRoutes(List<Tuple<BusRoute, string[], string[]>> routes, CompactFormatWriter writer)
 {
     for (int i = 0; i < routes.Count; i++)
     {
         var route = routes[i];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteQuotedString(route.Item1.Description);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Exemplo n.º 11
0
 public static async Task SavePendingDownloads()
 {
     CompactFormatWriter writer = new CompactFormatWriter();
     foreach (var route in PendingDownloadsCache)
     {
         foreach (var item in route)
         {
             writer.WriteString(item);
         }
         writer.NextItem();
     }
     var file = await ApplicationData.Current.LocalCacheFolder.GetFileAsync("PendingDownloadsCache.txt");
     await FileIO.WriteTextAsync(file, writer.ToString());
 }