static CifRecord Parse(string record) { CifRecord cifRecord = null; switch (record.Substring(0, 2)) { case "BS": cifRecord = BasicSchedule.FromCsv(record); break; case "BX": cifRecord = BasicScheduleExtraDetails.FromCsv(record); break; case "LO": cifRecord = OriginLocation.FromCsv(record); break; case "LI": cifRecord = IntermediateLocation.FromCsv(record); break; case "CR": cifRecord = ChangesEnRoute.FromCsv(record); break; case "LT": cifRecord = TerminatingLocation.FromCsv(record); break; default: break; } return(cifRecord); }
public static OriginLocation FromCsv(string csvLine) { string[] values = csvLine.Split(','); OriginLocation lo = new OriginLocation { RecordIdentity = values[0], Location = values[1], ScheduledDeparture = values[2], //WARNING! PublicDeparture in values[3] added at the end Platform = values[4], Line = values[5], EngineeringAllowance = values[6], PathingAllowance = values[7], Activity = values[8], PerformanceAllowance = values[9], ReservedField = values[10], Spare = values[11] }; Int32.TryParse(values[3], out lo.PublicDeparture); return(lo); }