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; } } } }
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 LocationStop ImportLocationStop(WienerLinienDataModell NewDataModell, JProperty Start) { LocationStop ActuallLocationStop = new LocationStop(); ActuallLocationStop.Parent = NewDataModell; NewDataModell.LocationStops.Add(ActuallLocationStop); foreach (JProperty LocProp in Start.Values()) { if (LocProp.Name == "type") { LocationType Output; if (Enum.TryParse(LocProp.Value.ToString(), true, out Output)) ActuallLocationStop.LocType = Output; else ActuallLocationStop.LocType = LocationType.Error; continue; } if (LocProp.Name == "geometry") { foreach (JProperty geoProp in LocProp.Values()) { if (geoProp.Name == "type") { GeometryType Output; if (Enum.TryParse(geoProp.Value.ToString(), true, out Output)) ActuallLocationStop.GeoType = Output; else ActuallLocationStop.GeoType = GeometryType.Error; continue; } if (geoProp.Name == "coordinates") { ActuallLocationStop.GeoLon = geoProp.Value.ToArray()[0].ToObject<double>(); ActuallLocationStop.GeoLat = geoProp.Value.ToArray()[1].ToObject<double>(); } } } if (LocProp.Name == "properties") { foreach (JProperty propProp in LocProp.Values()) { if (propProp.Name == "name") { ActuallLocationStop.Name = propProp.Value.ToString(); continue; } if (propProp.Name == "title") { ActuallLocationStop.Title = propProp.Value.ToString(); continue; } if (propProp.Name == "municipality") { ActuallLocationStop.Ort = propProp.Value.ToString(); continue; } if (propProp.Name == "municipalityId") { ActuallLocationStop.OrtID = propProp.Value.ToObject<Int32>(); continue; } if (propProp.Name == "type") { StopType Output; if (Enum.TryParse(propProp.Value.ToString(), true, out Output)) ActuallLocationStop.StopType = Output; else ActuallLocationStop.StopType = StopType.Error; continue; } if (propProp.Name == "coordName") { CoordType Output; if (Enum.TryParse(propProp.Value.ToString(), true, out Output)) ActuallLocationStop.CoType = Output; else ActuallLocationStop.CoType = CoordType.Error; continue; } if (propProp.Name == "gate") { ActuallLocationStop.Gate = propProp.Value.ToString(); continue; } if (propProp.Name == "attributes") { foreach (JProperty attrPropProp in propProp.Values()) { ActuallLocationStop.Attributes[attrPropProp.Name] = attrPropProp.Value.ToString(); } continue; } } } } return ActuallLocationStop; }