Created
November 12, 2014 06:03
-
-
Save manish/249fb66fbcec66e53497 to your computer and use it in GitHub Desktop.
A script to generate CommuterRail enumeration and CommuterRail Enum to Route Id Mapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*var routes = GetRoutes ().Select (x => x.Name.Replace (" ", "").Replace ("/", "")).ToList (); | |
var enumRoutes = string.Join (",\n", routes);*/ | |
var summaryHolder = | |
@"/// <summary> | |
/// {0} | |
/// </summary>"; | |
var allRoutesEnum = new List<string> (); | |
var allRoutesDict = new List<string> (); | |
var routes = GetRoutes (); | |
foreach (var route in routes) { | |
var directions = Stops.ByRoute (route.Id); | |
var direction = directions [0]; | |
var tripDesc = string.Format ("{0} to {1}", | |
direction.Stops.First ().StopName, | |
direction.Stops.Last ().StopName); | |
var summary = string.Format (summaryHolder, tripDesc); | |
var cleanupName = cleanUpRouteName (route.Name); | |
allRoutesEnum.Add (summary); | |
allRoutesEnum.Add (cleanupName); | |
allRoutesDict.Add (string.Format ("{{ CommuterRailLines.{0}, \"{1}\" }}", cleanupName, route.Id)); | |
} | |
var crEnum = string.Join (",\n", allRoutesEnum); | |
var allRoutes = string.Join (",\n", allRoutesDict); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment