From 6ffc5d917de4c3dad11771ef92fc8feb58dc61c2 Mon Sep 17 00:00:00 2001 From: AlyonaFr <149268946+AlyonaFr@users.noreply.github.com> Date: Thu, 2 May 2024 11:43:13 +0400 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=D0=B0=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectiongGenericObjects/StorageCollection.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ProjectCatamaran/ProjectCatamaran/CollectiongGenericObjects/StorageCollection.cs b/ProjectCatamaran/ProjectCatamaran/CollectiongGenericObjects/StorageCollection.cs index 38ac934..49cc24f 100644 --- a/ProjectCatamaran/ProjectCatamaran/CollectiongGenericObjects/StorageCollection.cs +++ b/ProjectCatamaran/ProjectCatamaran/CollectiongGenericObjects/StorageCollection.cs @@ -94,18 +94,18 @@ public class StorageCollection /// /// Путь и имя файла /// true - сохранение прошло успешно, false - ошибка при сохранении данных - public bool SaveData(string filename) + public bool SaveData(string filename) { if (_storages.Count == 0) { return false; - } + } if (File.Exists(filename)) { File.Delete(filename); - } + } using FileStream fs = new(filename, FileMode.Create); @@ -116,7 +116,7 @@ public class StorageCollection { streamWriter.Write(Environment.NewLine); - //не сохраняем пустые коллекции + if (value.Value.Count == 0) { continue; @@ -130,7 +130,7 @@ public class StorageCollection streamWriter.Write(_separatorForKeyValue); - foreach (T? item in value.Value.GetItems()) + foreach (T? item in value.Value.GetItems()) { string data = item?.GetDataForSave() ?? string.Empty; if (string.IsNullOrEmpty(data)) @@ -191,9 +191,9 @@ public class StorageCollection string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); foreach (string elem in set) { - if (elem?.CreateDrawningBoat() is T Truck) + if (elem?.CreateDrawningBoat() is T Boat) { - if (collection.Insert(Truck) == -1) + if (collection.Insert(Boat) == -1) return false; } }