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