убрала лишний комментарий
This commit is contained in:
parent
d9146f0613
commit
6ffc5d917d
@ -94,18 +94,18 @@ public class StorageCollection<T>
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
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<T>
|
||||
{
|
||||
streamWriter.Write(Environment.NewLine);
|
||||
|
||||
//не сохраняем пустые коллекции
|
||||
|
||||
if (value.Value.Count == 0)
|
||||
{
|
||||
continue;
|
||||
@ -130,7 +130,7 @@ public class StorageCollection<T>
|
||||
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<T>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user