diff --git a/ProjectLocomotive/ProjectLocomotive/MapWithSetLocomotivesGeneric.cs b/ProjectLocomotive/ProjectLocomotive/MapWithSetLocomotivesGeneric.cs index c32bdd1..4ac3618 100644 --- a/ProjectLocomotive/ProjectLocomotive/MapWithSetLocomotivesGeneric.cs +++ b/ProjectLocomotive/ProjectLocomotive/MapWithSetLocomotivesGeneric.cs @@ -147,5 +147,23 @@ namespace ProjectLocomotive } } } + /// Получение данных в виде строки + public string GetData(char separatorType, char separatorData) + { + string data = $"{_map.GetType().Name}{separatorType}"; + foreach (var locomotive in _setLocomotives.GetLocomotives()) + { + data += $"{locomotive.getInfo()}{separatorData}"; + } + return data; + } + /// Загрузка списка из массива строк + public void LoadData(string[] records) + { + foreach (var rec in records) + { + _setLocomotives.Insert(DrawningObject.Create(rec) as T); + } + } } }