Изменения в MapWithSetLocomotiveGeneric

This commit is contained in:
Sem730 2022-11-11 21:12:49 +03:00
parent 0c626b2cb3
commit 4b59366b42

View File

@ -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);
}
}
}
}