From 22b5a1266c5b041e4026e38f4f5ea2e3756b4590 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:40:49 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs | 2 +- .../RPP_FirstLaba_Tractor/TractorsCollectionInfo.cs | 5 +++++ .../RPP_FirstLaba_Tractor/TractorsGenericStorage.cs | 8 ++++---- RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/g.txt | 0 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/test.txt | 3 +++ .../RPP_FirstLaba_Tractor/набор №1.txt | 3 --- 6 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/g.txt create mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/test.txt delete mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs index bb9e0d7..a5168a1 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs @@ -63,7 +63,7 @@ namespace ProjectTractor.Generics if (equal != null) { if (_places.Contains(tractor, equal)) - throw new ArgumentException(nameof(tractor)); + throw new ArgumentException("Такой " + nameof(tractor) + " уже существует"); } _places.Insert(position, tractor); } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsCollectionInfo.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsCollectionInfo.cs index 0df4ef8..94e09a3 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsCollectionInfo.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsCollectionInfo.cs @@ -26,6 +26,11 @@ namespace ProjectTractor.Generics { return this.Name.GetHashCode(); } + + public override string ToString() + { + return Name; + } } } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs index ecf62a1..c924d0c 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs @@ -143,7 +143,7 @@ namespace ProjectTractor { throw new IOException("Нет данных для загрузки"); } - if (!strings[0].StartsWith("BusStorages")) + if (!strings[0].StartsWith("TractorStorages")) { throw new IOException("Неверный формат данных"); } @@ -160,10 +160,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)) { throw new IOException("Ошибка добавления в коллекцию"); } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/g.txt b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/g.txt deleted file mode 100644 index e69de29..0000000 diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/test.txt b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/test.txt new file mode 100644 index 0000000..c5f937a --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/test.txt @@ -0,0 +1,3 @@ +TractorStorages +gggg|100:100:Purple;100:100:Black;100:100:Silver;100:100:White;100:100:Yellow;100:100:Blue;100:100:Green;100:100:Red;100:100:Blue:Yellow:True:True; + diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt deleted file mode 100644 index 2a94cf2..0000000 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt +++ /dev/null @@ -1,3 +0,0 @@ -TractorStorage -gg|100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:White;100:100:Green:Purple:True:True;100:100:Yellow;100:100:White; -