示例#1
0
        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);
        }
示例#2
0
        public static ChangesEnRoute FromCsv(string csvLine)
        {
            string[]       values = csvLine.Split(',');
            ChangesEnRoute cer    = new ChangesEnRoute
            {
                RecordIdentity   = values[0],
                Location         = values[1],
                TrainCategory    = values[2],
                TrainIdentity    = values[3],
                Headcode         = values[4],
                CourseIndicator  = values[5],
                TrainServiceCode = values[6],
                PortionId        = values[7],
                PowerType        = values[8],
                TimingLoad       = values[9],
                //WARNING! Speed in values[10] added at the end
                OperatingCharacteristics = values[11],
                SeatingClass             = values[12],
                Sleepers            = values[13],
                Reservations        = values[14],
                ConnectionIndicator = values[15],
                CateringCode        = values[16],
                ServiceBranding     = values[17],
                TractionClass       = values[18],
                UicCode             = values[19],
                ReservedField       = values[20],
                Spare = values[21]
            };

            Int32.TryParse(values[10], out cer.Speed);

            return(cer);
        }