This commit is contained in:
Kirill 2024-02-28 13:40:49 +04:00
parent 52f3762b15
commit 22b5a1266c
6 changed files with 13 additions and 8 deletions

View File

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

View File

@ -26,6 +26,11 @@ namespace ProjectTractor.Generics
{
return this.Name.GetHashCode();
}
public override string ToString()
{
return Name;
}
}
}

View File

@ -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("Ошибка добавления в коллекцию");
}

View File

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

View File

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