Изменил(а) на 'ProjectPlane/ProjectPlane/MapsCollection.cs'

This commit is contained in:
devil_1nc 2022-11-08 17:31:30 +04:00
parent 270dda1a8f
commit 0379590e64

View File

@ -84,16 +84,28 @@ namespace ProjectPlane
byte[] info = new UTF8Encoding(true).GetBytes(text);
stream.Write(info, 0, info.Length);
}
public bool SaveDict(string filename)
public bool SaveData(string filename)
{
if (File.Exists(filename))
{
File.Delete(filename);
}
using (FileStream fs = new(filename, FileMode.Create))
using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
{
sw.WriteLine("MapsCollection");
foreach (var storage in _mapStorages)
{
sw.WriteLine(
$"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}"
);
}
}
return true;
}
/// <summary>
/// Загрузка нформации по автомобилям на парковках из файла
/// </summary>