public PacificTrack Parse() { var result = new TdmParser(text).Parse(); var mainRoute = result.MainRoute.Split( new char[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries) .ToRouteString(); var connectRoutes = ConnectionRouteInterpreter.Convert( mainRoute, result.ConnectionRoutes, airportList); return(new PacificTrack( PacotDirection.Westbound, result.Ident, result.TimeStart, result.TimeEnd, CutOffTextAfterParenthesis(result.Remarks), mainRoute, connectRoutes.RouteFrom, connectRoutes.RouteTo, Constants.JapanLatlon, Constants.USLatlon)); }
public void HasOnlyRts() { string msg = @"TDM TRK Ident TimeStart TimeEnd Main Route Main Route continued RTS/RouteFrom/To 1 RouteFrom/To 2 RouteFrom/To 3"; var parser = new TdmParser(msg); var result = parser.Parse(); Assert.IsTrue(result.Ident == "Ident"); Assert.IsTrue(result.TimeStart == "TimeStart"); Assert.IsTrue(result.TimeEnd == "TimeEnd"); Assert.IsTrue(result.MainRoute == @"Main Route Main Route continued "); Assert.IsTrue(result.ConnectionRoutes.SequenceEqual( new[] { "RouteFrom/To 1", "RouteFrom/To 2", "RouteFrom/To 3" })); Assert.IsTrue(result.Remarks == ""); }
/// <summary> /// Returns null is the given string represents a track which is /// currently not available. /// </summary> /// <exception cref="TrackParseException"></exception> public AusTrack Parse() { var result = new TdmParser(text).Parse(); var mainRoute = result.MainRoute.Split( new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries) .ToRouteString(); var connectRoutes = ConnectionRouteInterpreter.Convert( mainRoute, result.ConnectionRoutes, airportList); if (TrackAvailble(mainRoute, result.Ident)) { return(new AusTrack( result.Ident, result.TimeStart, result.TimeEnd, result.Remarks, mainRoute, connectRoutes.RouteFrom, connectRoutes.RouteTo, PreferredLatLon, PreferredLatLon)); } return(null); }
public void HasNeitherRtsNorRmk() { string msg = @"TDM TRK Ident TimeStart TimeEnd Main Route Main Route continued "; var parser = new TdmParser(msg); var result = parser.Parse(); Assert.IsTrue(result.Ident == "Ident"); Assert.IsTrue(result.TimeStart == "TimeStart"); Assert.IsTrue(result.TimeEnd == "TimeEnd"); Assert.IsTrue(result.MainRoute == @"Main Route Main Route continued "); Assert.AreEqual(0, result.ConnectionRoutes.Count); Assert.IsTrue(result.Remarks == ""); }