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