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; } } }