From 4b59366b429dc8402fcbf698e34235d0f19fd941 Mon Sep 17 00:00:00 2001 From: Sem730 Date: Fri, 11 Nov 2022 21:12:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B2=20MapWithSetLocomotiveGeneric?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MapWithSetLocomotivesGeneric.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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); + } + } } }