From 5ca50283c7fd1d72f04ee01cd2f0824a86fc9411 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Mon, 25 Dec 2023 22:24:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=822?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RPP_FirstLaba_Tractor/TractorsGenericStorage.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs index 273c34d..d71695f 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs @@ -114,7 +114,7 @@ namespace ProjectTractor } if (data.Length == 0) { - throw new Exception("Невалидная операция, нет данных для сохранения"); + return false; } using (StreamWriter streamWriter = new(filename)) { @@ -139,11 +139,11 @@ namespace ProjectTractor string[] strings = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); if (strings == null || strings.Length == 0) { - throw new IOException("Нет данных для загрузки"); + return false; } if (!strings[0].StartsWith("TractorStorage")) { - throw new IOException("Неверный формат данных"); + return false; } _tractorStorages.Clear(); do @@ -163,7 +163,7 @@ namespace ProjectTractor { if (!(collection + tractor)) { - throw new ArgumentNullException("Ошибка добавления в коллекцию"); + return false; } } }