Compare commits

...

3 Commits

Author SHA1 Message Date
c0f9ad8f17 konflict 2024-06-14 03:13:18 +03:00
d85edc7af6 lastkonflict 2024-06-12 18:11:50 +03:00
2d8d0c28a9 so ism 2024-04-24 14:48:16 +03:00

View File

@ -93,13 +93,13 @@ public class StorageCollection<T>
public void SaveData(string filename)
{
if (_storages.Count == 0)
if (_storages.Count == 0)
{
throw new Exception("В хранилище отсутствуют коллекции для сохранения");
}
if (File.Exists(filename))
if (File.Exists(filename))
{
File.Delete(filename);
File.Delete(filename);
}
using (StreamWriter writer = new StreamWriter(filename))
{
@ -110,7 +110,7 @@ public class StorageCollection<T>
sb.Append(Environment.NewLine);
if (value.Value.Count == 0)
{
continue;
continue;
}
sb.Append(value.Key);
sb.Append(_separatorForKeyValue);
@ -118,10 +118,10 @@ public class StorageCollection<T>
sb.Append(_separatorForKeyValue);
foreach (T? item in value.Value.GetItems())
{
string data = item?.GetDataForSave() ?? string.Empty;
if (string.IsNullOrEmpty(data))
string data = item?.GetDataForSave() ?? string.Empty;
if (string.IsNullOrEmpty(data))
{
continue;
continue;
}
sb.Append(data);
sb.Append(_separatorItems);
@ -195,6 +195,7 @@ public class StorageCollection<T>
}
/// <summary>
/// Создание коллекции по типу
/// </summary>