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

This commit is contained in:
devil_1nc 2022-12-01 21:24:57 +04:00
parent 62544c6b14
commit ad75bc4a52

View File

@ -84,7 +84,7 @@ namespace ProjectPlane
byte[] info = new UTF8Encoding(true).GetBytes(text); byte[] info = new UTF8Encoding(true).GetBytes(text);
stream.Write(info, 0, info.Length); stream.Write(info, 0, info.Length);
} }
public bool SaveData(string filename) public void SaveData(string filename)
{ {
if (File.Exists(filename)) if (File.Exists(filename))
{ {
@ -102,7 +102,6 @@ namespace ProjectPlane
); );
} }
} }
return true;
} }
@ -111,11 +110,11 @@ namespace ProjectPlane
/// </summary> /// </summary>
/// <param name="filename"></param> /// <param name="filename"></param>
/// <returns></returns> /// <returns></returns>
public bool LoadData(string filename) public void LoadData(string filename)
{ {
if (!File.Exists(filename)) if (!File.Exists(filename))
{ {
return false; throw new Exception("File not found");
} }
string bufferTextFromFile = ""; string bufferTextFromFile = "";
using (FileStream fs = new(filename, FileMode.Open)) using (FileStream fs = new(filename, FileMode.Open))
@ -125,7 +124,7 @@ namespace ProjectPlane
if (!curLine.Contains("MapsCollection")) if (!curLine.Contains("MapsCollection"))
{ {
return false; throw new Exception("Incorrect format");
} }
_mapStorages.Clear(); _mapStorages.Clear();
@ -147,7 +146,6 @@ namespace ProjectPlane
} }
} }
return true;
} }
} }
} }