diff --git a/AntiAircraftGun/CollectionGenericObjects/AbstractCompany.cs b/AntiAircraftGun/CollectionGenericObjects/AbstractCompany.cs
index 74b107e..af9fd2a 100644
--- a/AntiAircraftGun/CollectionGenericObjects/AbstractCompany.cs
+++ b/AntiAircraftGun/CollectionGenericObjects/AbstractCompany.cs
@@ -50,7 +50,7 @@ public abstract class AbstractCompany
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
- _collection.SetMaxCount = GetMaxCount;
+ _collection.MaxCount = GetMaxCount;
}
///
diff --git a/AntiAircraftGun/CollectionGenericObjects/ListGenericObjects.cs b/AntiAircraftGun/CollectionGenericObjects/ListGenericObjects.cs
index 29754d8..3c2a312 100644
--- a/AntiAircraftGun/CollectionGenericObjects/ListGenericObjects.cs
+++ b/AntiAircraftGun/CollectionGenericObjects/ListGenericObjects.cs
@@ -20,10 +20,23 @@ public class ListGenericObjects : ICollectionGenericObjects
public int Count => _collection.Count;
- public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
-
public CollectionType GetCollectionType => CollectionType.List;
+ public int MaxCount
+ {
+ get
+ {
+ return Count;
+ }
+ set
+ {
+ if (value > 0)
+ {
+ _maxCount = value;
+ }
+ }
+ }
+
///
/// Конструктор
///
diff --git a/AntiAircraftGun/CollectionGenericObjects/StorageCollection.cs b/AntiAircraftGun/CollectionGenericObjects/StorageCollection.cs
index 3e2b2fc..f51f689 100644
--- a/AntiAircraftGun/CollectionGenericObjects/StorageCollection.cs
+++ b/AntiAircraftGun/CollectionGenericObjects/StorageCollection.cs
@@ -196,7 +196,7 @@ public class StorageCollection
{
if (elem?.CreateDrawningArmoredCar() is T car)
{
- if (!collection.Insert(car))
+ if (collection.Insert(car)== -1)
{
return false;
}
diff --git a/AntiAircraftGun/Drawnings/DrawningAntiAircraftGun.cs b/AntiAircraftGun/Drawnings/DrawningAntiAircraftGun.cs
index c55e767..4e32d8b 100644
--- a/AntiAircraftGun/Drawnings/DrawningAntiAircraftGun.cs
+++ b/AntiAircraftGun/Drawnings/DrawningAntiAircraftGun.cs
@@ -21,6 +21,14 @@ public class DrawningAntiAircraftGun : DrawningArmoredCar
EntityAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor, radar, tower, additionalColor);
}
///
+ /// Конструктор для Extention
+ ///
+ ///
+ public DrawningAntiAircraftGun(EntityAntiAircraftGun armoredCar) : base(130, 60)
+ {
+ EntityAircraftGun = new EntityAntiAircraftGun(armoredCar.Speed, armoredCar.Weight, armoredCar.BodyColor, armoredCar.Radar, armoredCar.Tower, armoredCar.AdditionalColor);
+ }
+ ///
/// Прорисовка объекта
///
///
diff --git a/AntiAircraftGun/Drawnings/DrawningArmoredCar.cs b/AntiAircraftGun/Drawnings/DrawningArmoredCar.cs
index a629544..5df00b0 100644
--- a/AntiAircraftGun/Drawnings/DrawningArmoredCar.cs
+++ b/AntiAircraftGun/Drawnings/DrawningArmoredCar.cs
@@ -92,6 +92,14 @@ public class DrawningArmoredCar
_drawningGunHeight = drawningGunHeight;
}
///
+ /// Конструктор для Extention
+ ///
+ ///
+ public DrawningArmoredCar(EntityArmoredCar armoredCar) : this()
+ {
+ EntityAircraftGun = new EntityArmoredCar(armoredCar.Speed, armoredCar.Weight, armoredCar.BodyColor);
+ }
+ ///
/// Установка границ поля
///
///
diff --git a/AntiAircraftGun/Drawnings/ExtentionDrawningArmoredCar.cs b/AntiAircraftGun/Drawnings/ExtentionDrawningArmoredCar.cs
index 9ec764c..e8006cf 100644
--- a/AntiAircraftGun/Drawnings/ExtentionDrawningArmoredCar.cs
+++ b/AntiAircraftGun/Drawnings/ExtentionDrawningArmoredCar.cs
@@ -24,13 +24,13 @@ public static class ExtentionDrawningArmoredCar
public static DrawningArmoredCar? CreateDrawningArmoredCar(this string info)
{
string[] strs = info.Split(_separatorForObject);
- DrawningArmoredCar? armoredCar = EntityAntiAircraftGun.CreateEntityAntiAircraftGun(strs);
+ EntityArmoredCar? armoredCar = EntityAntiAircraftGun.CreateEntityAntiAircraftGun(strs);
if (armoredCar != null)
{
- return new DrawningAntiAircraftGun(armoredCar);
+ return new DrawningAntiAircraftGun((EntityAntiAircraftGun)armoredCar);
}
- armoredCar = DrawningArmoredCar.CreateEntityArmoredCar(strs);
+ armoredCar = EntityArmoredCar.CreateEntityArmoredCar(strs);
if (armoredCar != null)
{
return new DrawningArmoredCar(armoredCar);
diff --git a/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs b/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
index 3d1baaf..241fa2f 100644
--- a/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
+++ b/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
@@ -1,4 +1,6 @@
-namespace AntiAircraftGun.Entities;
+using AntiAircraftGun.Drawnings;
+
+namespace AntiAircraftGun.Entities;
///
/// Класс-сущность Зенитная установка
///
@@ -40,4 +42,28 @@ public class EntityAntiAircraftGun : EntityArmoredCar
Tower = tower;
AdditionalColor = additionalColor;
}
+
+ ///
+ /// Получение строк со значениями свойств продвинутого объекта класса-сущности
+ ///
+ ///
+ public override string[] GetStringRepresentation()
+ {
+ return new[] { nameof(EntityAntiAircraftGun), Speed.ToString(), Weight.ToString(), BodyColor.Name, Tower.ToString(), Radar.ToString(), AdditionalColor.Name};
+ }
+
+ ///
+ /// Создание продвинутого объекта из массива строк
+ ///
+ ///
+ ///
+ public static EntityAntiAircraftGun? CreateEntityAntiAircraftGun(string[] strs)
+ {
+ if (strs.Length != 7 || strs[0] != nameof(EntityAntiAircraftGun))
+ {
+ return null;
+ }
+ return new EntityAntiAircraftGun(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Convert.ToBoolean(strs[4]),
+ Convert.ToBoolean(strs[5]),Color.FromName(strs[6]));
+ }
}
diff --git a/AntiAircraftGun/Entities/EntityArmoredCar.cs b/AntiAircraftGun/Entities/EntityArmoredCar.cs
index b52bb85..093e261 100644
--- a/AntiAircraftGun/Entities/EntityArmoredCar.cs
+++ b/AntiAircraftGun/Entities/EntityArmoredCar.cs
@@ -55,7 +55,7 @@ public class EntityArmoredCar
///
///
///
- public static EntityArmoredCar? CreateEntityTrackedCar(string[] strs)
+ public static EntityArmoredCar? CreateEntityArmoredCar(string[] strs)
{
if (strs.Length != 4 || strs[0] != nameof(EntityArmoredCar))
{
diff --git a/AntiAircraftGun/FormArmoredCarCollection.Designer.cs b/AntiAircraftGun/FormArmoredCarCollection.Designer.cs
index c740677..be62389 100644
--- a/AntiAircraftGun/FormArmoredCarCollection.Designer.cs
+++ b/AntiAircraftGun/FormArmoredCarCollection.Designer.cs
@@ -68,7 +68,7 @@
groupBoxToools.Dock = DockStyle.Right;
groupBoxToools.Location = new Point(1057, 24);
groupBoxToools.Name = "groupBoxToools";
- groupBoxToools.Size = new Size(210, 591);
+ groupBoxToools.Size = new Size(210, 612);
groupBoxToools.TabIndex = 0;
groupBoxToools.TabStop = false;
groupBoxToools.Text = "Инструменты";
@@ -248,7 +248,7 @@
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 24);
pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(1057, 591);
+ pictureBox.Size = new Size(1057, 612);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
@@ -296,7 +296,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1267, 615);
+ ClientSize = new Size(1267, 636);
Controls.Add(pictureBox);
Controls.Add(groupBoxToools);
Controls.Add(menuStrip);