lots of changes 2 laba 6

This commit is contained in:
Timourka 2023-11-17 23:20:15 +04:00
parent 81399704cd
commit 4f448847d7

View File

@ -38,7 +38,7 @@ namespace Laba1Loco
foreach (KeyValuePair<string, TrainsGenericCollection<DrawingTrain, DrawningObjectTrain>> record in _trainStorages) foreach (KeyValuePair<string, TrainsGenericCollection<DrawingTrain, DrawningObjectTrain>> record in _trainStorages)
{ {
StringBuilder records = new StringBuilder(); StringBuilder records = new StringBuilder();
foreach (DrawingTrain elem in record.Value.GetTrains.Reverse()) foreach (DrawingTrain elem in record.Value.GetTrains)
{ {
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}"); records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
} }
@ -84,7 +84,7 @@ namespace Laba1Loco
} }
TrainsGenericCollection<DrawingTrain, DrawningObjectTrain> collection = new(_pictureWidth, _pictureHeight); TrainsGenericCollection<DrawingTrain, DrawningObjectTrain> collection = new(_pictureWidth, _pictureHeight);
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries); string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set) foreach (string elem in set.Reverse())
{ {
DrawingTrain car = elem?.CreateDrawingTrain(_separatorForObject, _pictureWidth, _pictureHeight); DrawingTrain car = elem?.CreateDrawingTrain(_separatorForObject, _pictureWidth, _pictureHeight);
if (car != null) if (car != null)