private void ImportDeparture(TrafficLine ActuallTrafficLine, JProperty Start) { foreach (JProperty DepArrProp in Start.Values()) { if (DepArrProp.Name == "departure") { foreach (JObject TimeObject in DepArrProp.Values().ToList()) { foreach (JProperty TimeProp in TimeObject.Properties()) { if (TimeProp.Name == "departureTime") { Departure ActuallDeparture = new Departure(); ActuallDeparture.Parent = ActuallTrafficLine; ActuallDeparture.DeArType = DepartureArrivelType.departureTime; ActuallTrafficLine.Departures.Add(ActuallDeparture); foreach (JProperty TimeTimeProject in TimeProp.Value.ToList()) { if (TimeTimeProject.Name == "timePlanned") { ActuallDeparture.TimePlanned = TimeTimeProject.Value.ToObject<DateTime>(); } if (TimeTimeProject.Name == "timeReal") { ActuallDeparture.TimeReal = TimeTimeProject.Value.ToObject<DateTime>(); } if (TimeTimeProject.Name == "countdown") { ActuallDeparture.CountDown = TimeTimeProject.Value.ToObject<Int32>(); } } } if (TimeProp.Name == "vehicle") { } } } } } }
private void ImportLines(LocationStop ActuallLocationStop, JProperty Start) { foreach (JObject LinProp in Start.Values().ToList()) { TrafficLine ActuallTrafficLine = new TrafficLine(); ActuallTrafficLine.Parent = ActuallLocationStop; ActuallLocationStop.TrafficLines.Add(ActuallTrafficLine); foreach (JProperty LinLinProp in LinProp.Properties()) { if (LinLinProp.Name == "name") { ActuallTrafficLine.Name = LinLinProp.Value.ToString(); continue; } if (LinLinProp.Name == "towards") { ActuallTrafficLine.Towards = LinLinProp.Value.ToString(); continue; } if (LinLinProp.Name == "direction") { ActuallTrafficLine.Direction = LinLinProp.Value.ToString(); continue; } if (LinLinProp.Name == "platform") { ActuallTrafficLine.PlatForm = LinLinProp.Value.ToString(); continue; } if (LinLinProp.Name == "richtungsId") { ActuallTrafficLine.RichtungsID = LinLinProp.Value.ToString(); continue; } if (LinLinProp.Name == "barrierFree") { ActuallTrafficLine.BarriereFrei = LinLinProp.Value.ToObject<bool>(); continue; } if (LinLinProp.Name == "realtimeSupported") { ActuallTrafficLine.RealTimeSupported = LinLinProp.Value.ToObject<bool>(); continue; } if (LinLinProp.Name == "trafficjam") { ActuallTrafficLine.TrafficJam = LinLinProp.Value.ToObject<bool>(); continue; } if (LinLinProp.Name == "departures") { ImportDeparture(ActuallTrafficLine, LinLinProp); continue; } if (LinLinProp.Name == "type") { LineType Output; if (Enum.TryParse(LinLinProp.Value.ToString(), true, out Output)) ActuallTrafficLine.LiType = Output; else ActuallTrafficLine.LiType = LineType.Error; continue; } if (LinLinProp.Name == "lineId") { ActuallTrafficLine.LineID = LinLinProp.Value.ToObject<Int32>(); continue; } } } }