Добавлены методы сериализации и десериализации в класс MapWithSetArtilleriesGeneric

This commit is contained in:
Сергей Полевой 2022-11-04 16:49:23 +04:00
parent baff437cf5
commit cd93fadd3b

View File

@ -124,5 +124,23 @@ namespace Artilleries
index++; index++;
} }
} }
public string GetData(char separatorType, char separatorData)
{
string data = $"{_map.GetType().Name}{separatorType}";
foreach (var artillery in _setArtilleries.GetArtilleries())
{
data += $"{artillery.GetInfo()}{separatorData}";
}
return data;
}
public void LoadData(string[] records)
{
foreach (var record in records)
{
_setArtilleries.Insert(DrawingObjectArtillery.Create(record) as T);
}
}
} }
} }