API.WebClients.GoogleTransitClient.ParseRouteCSV C# (CSharp) Method

ParseRouteCSV() private static method

Reads a ZipArchive entry as the routes CSV and extracts the route colors.
private static ParseRouteCSV ( ZipArchiveEntry entry ) : List
entry System.IO.Compression.ZipArchiveEntry
return List
        private static List<GoogleRoute> ParseRouteCSV(ZipArchiveEntry entry)
        {
            var routes = new List<GoogleRoute>();

            using (var reader = new StreamReader(entry.Open()))
            {
                // Ignore the format line
                reader.ReadLine();

                while (!reader.EndOfStream)
                {
                    var parts = reader.ReadLine().Split(',');

                    // Ignore all routes which aren't part of CTS and thus don't have any real-time data.
                    if (parts[0].Contains("ATS") || parts[0].Contains("PC") || parts[0].Contains("LBL"))
                    {
                        continue;
                    }

                    routes.Add(new GoogleRoute(parts));
                }
            }

            if(!routes.Any(x => x.Name == "C1R"))
            {
                routes.Add(new GoogleRoute("C1R", "9F8E7D", "http://www.corvallisoregon.gov/index.aspx?page=1774"));
            }
            return routes;
        }