public void LinkTrainMultiple(Train orig, TimeEntry offset, TimeEntry diff, int count, ITrainNameGen tnc) { if (orig.ParentTimetable !.Type == TimetableType.Network && orig.ParentTimetable !.Version.CompareTo(TimetableVersion.Extended_FPL2) < 0) { throw new TimetableTypeNotSupportedException("train links"); } if (count < 0) { throw new ArgumentException("Value must be greater than or equal to zero", nameof(count)); } var link = new TrainLink(orig, count) { TimeDifference = diff, TimeOffset = offset, TrainNamingScheme = tnc, }; orig.AddLink(link); for (int i = 0; i < count; i++) { var linkedTrain = new LinkedTrain(link, i); orig.ParentTimetable !.AddTrain(linkedTrain); } }
//HACK: This is intentional and may lead to a crash when a part contains a semicolon. But jTrainGraph does is like that. /// <summary> /// Serialize this instance to a string as it will be stored in the XML structure. /// </summary> public static string Serialize(ITrainNameGen tnc) => string.Join(";", tnc.Serialize());