Dolgov D.A. Lab Work 6 #6

Closed
devil_1nc wants to merge 5 commits from LabWork06 into LabWork05
Showing only changes of commit 0379590e64 - Show all commits

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>