diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/CarNotFoundException.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/CarNotFoundException.cs new file mode 100644 index 0000000..19b8d4a --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/CarNotFoundException.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.Serialization; + + +namespace ProjectTractor.Exceptions +{ + [Serializable] + internal class CarNotFoundException : ApplicationException + { + public CarNotFoundException(int i) : base($"Не найден объект по позиции { i}") { } + public CarNotFoundException() : base() { } + public CarNotFoundException(string message) : base(message) { } + public CarNotFoundException(string message, Exception exception) : + base(message, exception) + { } + protected CarNotFoundException(SerializationInfo info, + StreamingContext contex) : base(info, contex) { } + } + +} diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/StorageOverflowException.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/StorageOverflowException.cs new file mode 100644 index 0000000..81d05e7 --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/StorageOverflowException.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.Serialization; + + +namespace ProjectTractor.Exceptions +{ + [Serializable] + internal class StorageOverflowException : ApplicationException + { + public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: { count}") { } + public StorageOverflowException() : base() { } + public StorageOverflowException(string message) : base(message) { } + public StorageOverflowException(string message, Exception exception) + : base(message, exception) { } + protected StorageOverflowException(SerializationInfo info, + StreamingContext contex) : base(info, contex) { } + } + +} diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs index 00378ca..d71695f 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs @@ -158,10 +158,10 @@ namespace ProjectTractor string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries); foreach (string elem in set) { - DrawningTractor? bus = elem?.CreateDrawningTractor(_separatorForObject, _pictureWidth, _pictureHeight); - if (bus != null) + DrawningTractor? tractor = elem?.CreateDrawningTractor(_separatorForObject, _pictureWidth, _pictureHeight); + if (tractor != null) { - if (!(collection + bus)) + if (!(collection + tractor)) { return false; }