From 28c89d7744dff2fd28e32f41d50a8997e4db34b4 Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Fri, 25 Nov 2022 17:31:38 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'ProjectPlane/ProjectPlane/MapsCollect?= =?UTF-8?q?ion.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectPlane/ProjectPlane/MapsCollection.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ProjectPlane/ProjectPlane/MapsCollection.cs b/ProjectPlane/ProjectPlane/MapsCollection.cs index 50643a9..b443f07 100644 --- a/ProjectPlane/ProjectPlane/MapsCollection.cs +++ b/ProjectPlane/ProjectPlane/MapsCollection.cs @@ -36,7 +36,7 @@ namespace ProjectPlane /// private readonly char separatorData = ';'; - public MapsCollection(int pictureWidth, int pictureHeight) + public MapsCollection(int pictureWidth, int pictureHeight) { _mapStorages = new Dictionary>(); _pictureWidth = pictureWidth; @@ -84,7 +84,7 @@ namespace ProjectPlane byte[] info = new UTF8Encoding(true).GetBytes(text); stream.Write(info, 0, info.Length); } - public bool SaveData(string filename) + public void SaveData(string filename) { if (File.Exists(filename)) { @@ -102,7 +102,6 @@ namespace ProjectPlane ); } } - } @@ -111,11 +110,11 @@ namespace ProjectPlane /// /// /// - public bool LoadData(string filename) + public void LoadData(string filename) { if (!File.Exists(filename)) { - return false; + throw new Exception("File not found"); } string bufferTextFromFile = ""; using (FileStream fs = new(filename, FileMode.Open)) @@ -125,7 +124,7 @@ namespace ProjectPlane if (!curLine.Contains("MapsCollection")) { - return false; + throw new Exception("Incorrect format"); } _mapStorages.Clear();