private static List <Route> ExtractRoutes(TransportType transportType, FileInfo[] routeFiles, IMessageClient helper = null) { var routes = new List <Route>(); var deserializer = new DeserializerBuilder() .WithNamingConvention(new CamelCaseNamingConvention()) .Build(); foreach (var routeFile in routeFiles) { using (var reader = new StreamReader(routeFile.FullName)) { var routeInfo = reader.ReadToEnd(); var route = deserializer.Deserialize <Route>(routeInfo); route.TransportType = transportType; routes.Add(route); // Sets up queue if it doesn't exist if (helper != null) { helper.SetupQueue(route.Destination.MessageQueue); } } } return(routes); }
public static List <Route> GetRoutes(string path, TransportType transportType, IMessageClient helper = null) { var routeFiles = GetFiles(path, "*.yml"); return(ExtractRoutes(transportType, routeFiles, helper)); }