From fc9c2e7db3b0ad6689562bc401b7b8896d60e68d Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Tue, 19 Dec 2023 18:46:53 +0400 Subject: [PATCH 1/6] =?UTF-8?q?"=D0=95=D1=81=D0=BB=D0=B8=20=D0=BE=D1=85?= =?UTF-8?q?=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=20=D0=BD=D0=B5=20=D0=B8=D0=B4?= =?UTF-8?q?=D0=B5=D1=82=20=D0=BA=20=D0=B7=D0=B2=D0=B5=D1=80=D1=8E,=20?= =?UTF-8?q?=D1=82=D0=BE=20=D0=B7=D0=B2=D0=B5=D1=80=D1=8C=20=D0=B8=D0=B4?= =?UTF-8?q?=D0=B5=D1=82=20...."=20-=20=D0=9D.=20=D0=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/DrawingPlaneEqutables.cs | 59 +++++++++++++++++++ .../AirBomber/FormPlaneCollection.Designer.cs | 34 +++++++++-- AirBomber/AirBomber/FormPlaneCollection.cs | 27 ++++++++- AirBomber/AirBomber/PlaneCompareByColor.cs | 32 ++++++++++ AirBomber/AirBomber/PlaneCompareByType.cs | 32 ++++++++++ AirBomber/AirBomber/PlanesCollectionInfo.cs | 27 +++++++++ .../AirBomber/PlanesGenericCollection.cs | 5 +- AirBomber/AirBomber/PlanesGenericStorage.cs | 23 ++++---- AirBomber/AirBomber/SetGeneric.cs | 13 +++- 9 files changed, 232 insertions(+), 20 deletions(-) create mode 100644 AirBomber/AirBomber/DrawingPlaneEqutables.cs create mode 100644 AirBomber/AirBomber/PlaneCompareByColor.cs create mode 100644 AirBomber/AirBomber/PlaneCompareByType.cs create mode 100644 AirBomber/AirBomber/PlanesCollectionInfo.cs diff --git a/AirBomber/AirBomber/DrawingPlaneEqutables.cs b/AirBomber/AirBomber/DrawingPlaneEqutables.cs new file mode 100644 index 0000000..c7ebf1c --- /dev/null +++ b/AirBomber/AirBomber/DrawingPlaneEqutables.cs @@ -0,0 +1,59 @@ +using ProjectAirBomber.DrawingObjects; +using ProjectAirBomber.Entities; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class DrawingPlaneEqutables : IEqualityComparer + { + public bool Equals(DrawingPlane? x, DrawingPlane? y) + { + if (x == null || x.EntityPlane == null) + { + throw new ArgumentNullException(nameof(x)); + } + if (y == null || y.EntityPlane == null) + { + throw new ArgumentNullException(nameof(y)); + } + if (x.GetType().Name != y.GetType().Name) + { + return false; + } + if (x.EntityPlane.Speed != y.EntityPlane.Speed) + { + return false; + } + if (x.EntityPlane.Weight != y.EntityPlane.Weight) + { + return false; + } + if (x.EntityPlane.BodyColor != y.EntityPlane.BodyColor) + { + return false; + } + if (x is DrawingAirBomber && y is DrawingAirBomber) + { + EntityAirBomber EntityX = (EntityAirBomber)x.EntityPlane; + EntityAirBomber EntityY = (EntityAirBomber)y.EntityPlane; + if (EntityX.Bombs != EntityY.Bombs) + return false; + if (EntityX.Fuel != EntityY.Fuel) + return false; + if (EntityX.AdditionalColor != EntityY.AdditionalColor) + return false; + } + return true; + } + + public int GetHashCode([DisallowNull] DrawingPlane? obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs index 3c7225c..e90ad52 100644 --- a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs +++ b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs @@ -32,6 +32,8 @@ namespace ProjectAirBomber { pictureBoxCollection = new PictureBox(); groupBoxTools = new GroupBox(); + button2 = new Button(); + button1 = new Button(); GroupBoxSets = new GroupBox(); buttonDelObject = new Button(); buttonAddObject = new Button(); @@ -65,6 +67,8 @@ namespace ProjectAirBomber // groupBoxTools // groupBoxTools.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + groupBoxTools.Controls.Add(button2); + groupBoxTools.Controls.Add(button1); groupBoxTools.Controls.Add(GroupBoxSets); groupBoxTools.Controls.Add(ButtonRefreshCollection); groupBoxTools.Controls.Add(ButtonRemovePlane); @@ -77,6 +81,26 @@ namespace ProjectAirBomber groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; // + // button2 + // + button2.Location = new Point(12, 375); + button2.Name = "button2"; + button2.Size = new Size(190, 29); + button2.TabIndex = 6; + button2.Text = "Сортировка по цвету"; + button2.UseVisualStyleBackColor = true; + button2.Click += ButtonSortByColor_Click; + // + // button1 + // + button1.Location = new Point(11, 340); + button1.Name = "button1"; + button1.Size = new Size(190, 29); + button1.TabIndex = 5; + button1.Text = "Сортировка по типу"; + button1.UseVisualStyleBackColor = true; + button1.Click += ButtonSortByType_Click; + // // GroupBoxSets // GroupBoxSets.Anchor = AnchorStyles.Top | AnchorStyles.Right; @@ -150,14 +174,14 @@ namespace ProjectAirBomber // // maskedTextBoxNumber // - maskedTextBoxNumber.Location = new Point(28, 435); + maskedTextBoxNumber.Location = new Point(27, 492); maskedTextBoxNumber.Name = "maskedTextBoxNumber"; maskedTextBoxNumber.Size = new Size(162, 27); maskedTextBoxNumber.TabIndex = 1; // // ButtonAddPlane // - ButtonAddPlane.Location = new Point(11, 338); + ButtonAddPlane.Location = new Point(11, 436); ButtonAddPlane.Name = "ButtonAddPlane"; ButtonAddPlane.Size = new Size(190, 50); ButtonAddPlane.TabIndex = 0; @@ -195,14 +219,14 @@ namespace ProjectAirBomber // SaveToolStripMenuItem // SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; - SaveToolStripMenuItem.Size = new Size(224, 26); + SaveToolStripMenuItem.Size = new Size(166, 26); SaveToolStripMenuItem.Text = "Сохранить"; SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; // // LoadToolStripMenuItem // LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; - LoadToolStripMenuItem.Size = new Size(224, 26); + LoadToolStripMenuItem.Size = new Size(166, 26); LoadToolStripMenuItem.Text = "Загрузить"; LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; // @@ -247,5 +271,7 @@ namespace ProjectAirBomber private ToolStripMenuItem ToolStripMenuItem; private ToolStripMenuItem SaveToolStripMenuItem; private ToolStripMenuItem LoadToolStripMenuItem; + private Button button2; + private Button button1; } } \ No newline at end of file diff --git a/AirBomber/AirBomber/FormPlaneCollection.cs b/AirBomber/AirBomber/FormPlaneCollection.cs index 49e42b0..9ff38ab 100644 --- a/AirBomber/AirBomber/FormPlaneCollection.cs +++ b/AirBomber/AirBomber/FormPlaneCollection.cs @@ -1,5 +1,6 @@ using System; using AirBomber.Exceptions; +using AirBomber; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -40,7 +41,7 @@ namespace ProjectAirBomber listBoxStorages.Items.Clear(); for (int i = 0; i < _storage.Keys.Count; i++) { - listBoxStorages.Items.Add(_storage.Keys[i]); + listBoxStorages.Items.Add(_storage.Keys[i].Name); } if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count)) @@ -132,6 +133,11 @@ namespace ProjectAirBomber Log.Warning($"Коллекция {listBoxStorages.SelectedItem.ToString() ?? string.Empty} переполнена"); MessageBox.Show(ex.Message); } + catch (ArgumentException) + { + Log.Warning($"Добавляемый объект уже существует в коллекции {listBoxStorages.SelectedItem.ToString() ?? string.Empty}"); + MessageBox.Show("Добавляемый объект уже сущесвует в коллекции"); + } }); form.AddEvent(planeDelegate); } @@ -248,6 +254,25 @@ namespace ProjectAirBomber } } } + private void ButtonSortByType_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByType()); + + private void ButtonSortByColor_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByColor()); + + private void ComparePlanes(IComparer comparer) + { + if (listBoxStorages.SelectedIndex == -1) + { + return; + } + var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? + string.Empty]; + if (obj == null) + { + return; + } + obj.Sort(comparer); + pictureBoxCollection.Image = obj.ShowPlanes(); + } } } diff --git a/AirBomber/AirBomber/PlaneCompareByColor.cs b/AirBomber/AirBomber/PlaneCompareByColor.cs new file mode 100644 index 0000000..91746eb --- /dev/null +++ b/AirBomber/AirBomber/PlaneCompareByColor.cs @@ -0,0 +1,32 @@ +using ProjectAirBomber.DrawingObjects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class PlaneCompareByColor : IComparer + { + public int Compare(DrawingPlane? x, DrawingPlane? y) + { + if (x == null || x.EntityPlane == null) + throw new ArgumentNullException(nameof(x)); + + if (y == null || y.EntityPlane == null) + throw new ArgumentNullException(nameof(y)); + + if (x.EntityPlane.BodyColor.Name != y.EntityPlane.BodyColor.Name) + { + return x.EntityPlane.BodyColor.Name.CompareTo(y.EntityPlane.BodyColor.Name); + } + + var speedCompare = x.EntityPlane.Speed.CompareTo(y.EntityPlane.Speed); + if (speedCompare != 0) + return speedCompare; + + return x.EntityPlane.Weight.CompareTo(y.EntityPlane.Weight); + } + } +} diff --git a/AirBomber/AirBomber/PlaneCompareByType.cs b/AirBomber/AirBomber/PlaneCompareByType.cs new file mode 100644 index 0000000..46ba22e --- /dev/null +++ b/AirBomber/AirBomber/PlaneCompareByType.cs @@ -0,0 +1,32 @@ +using ProjectAirBomber.DrawingObjects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class PlaneCompareByType : IComparer + { + public int Compare(DrawingPlane? x, DrawingPlane? y) + { + if (x == null || x.EntityPlane == null) + throw new ArgumentNullException(nameof(x)); + + if (y == null || y.EntityPlane == null) + throw new ArgumentNullException(nameof(y)); + + if (x.GetType().Name != y.GetType().Name) + { + return x.GetType().Name.CompareTo(y.GetType().Name); + } + + var speedCompare = x.EntityPlane.Speed.CompareTo(y.EntityPlane.Speed); + if (speedCompare != 0) + return speedCompare; + + return x.EntityPlane.Weight.CompareTo(y.EntityPlane.Weight); + } + } +} diff --git a/AirBomber/AirBomber/PlanesCollectionInfo.cs b/AirBomber/AirBomber/PlanesCollectionInfo.cs new file mode 100644 index 0000000..411e88d --- /dev/null +++ b/AirBomber/AirBomber/PlanesCollectionInfo.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class PlanesCollectionInfo : IEquatable + { + public string Name { get; private set; } + public string Description { get; private set; } + public PlanesCollectionInfo(string name, string description) + { + Name = name; + Description = description; + } + public bool Equals(PlanesCollectionInfo? other) + { + return Name == other.Name; + } + public override int GetHashCode() + { + return this.Name.GetHashCode(); + } + } +} diff --git a/AirBomber/AirBomber/PlanesGenericCollection.cs b/AirBomber/AirBomber/PlanesGenericCollection.cs index f9dd82e..3caba8d 100644 --- a/AirBomber/AirBomber/PlanesGenericCollection.cs +++ b/AirBomber/AirBomber/PlanesGenericCollection.cs @@ -1,6 +1,7 @@ using ProjectAirBomber.Generics; using ProjectAirBomber.DrawingObjects; using ProjectAirBomber.MovementStrategy; +using AirBomber; using System; using System.Collections.Generic; using System.Linq; @@ -34,6 +35,8 @@ namespace ProjectAirBomber.Generics /// Набор объектов /// private readonly SetGeneric _collection; + + public void Sort(IComparer comparer) => _collection.SortSet(comparer); /// /// Получение объектов коллекции /// @@ -61,7 +64,7 @@ namespace ProjectAirBomber.Generics { if (obj == null || collect == null) return false; - collect._collection.Insert(obj); + collect._collection.Insert(obj, new DrawingPlaneEqutables()); return true; } /// diff --git a/AirBomber/AirBomber/PlanesGenericStorage.cs b/AirBomber/AirBomber/PlanesGenericStorage.cs index 0c5048d..45e13d7 100644 --- a/AirBomber/AirBomber/PlanesGenericStorage.cs +++ b/AirBomber/AirBomber/PlanesGenericStorage.cs @@ -31,14 +31,14 @@ namespace ProjectAirBomber.Generics File.Delete(filename); } StringBuilder data = new(); - foreach (KeyValuePair> record in _planeStorage) + foreach (KeyValuePair> record in _planeStorage) { StringBuilder records = new(); foreach (DrawingPlane? elem in record.Value.GetPlanes) { records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}"); } - data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}"); + data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}"); } if (data.Length == 0) { @@ -92,22 +92,22 @@ namespace ProjectAirBomber.Generics } } } - _planeStorage.Add(record[0], collection); + _planeStorage.Add(new PlanesCollectionInfo(record[0], string.Empty), collection); str = sr.ReadLine(); } while (str != null); } return; } - readonly Dictionary> _planeStorage; - public List Keys => _planeStorage.Keys.ToList(); + public List Keys => _planeStorage.Keys.ToList(); private readonly int _pictureWidth; private readonly int _pictureHeight; public PlanesGenericStorage(int pictureWidth, int pictureHeight) { - _planeStorage = new Dictionary>(); _pictureWidth = pictureWidth; _pictureHeight = pictureHeight; @@ -115,24 +115,25 @@ namespace ProjectAirBomber.Generics public void AddSet(string name) { - _planeStorage.Add(name, + _planeStorage.Add(new PlanesCollectionInfo(name, string.Empty), new PlanesGenericCollection(_pictureWidth, _pictureHeight)); } public void DelSet(string name) { - if (!_planeStorage.ContainsKey(name)) + if (!_planeStorage.ContainsKey(new PlanesCollectionInfo(name, string.Empty))) return; - _planeStorage.Remove(name); + _planeStorage.Remove(new PlanesCollectionInfo(name, string.Empty)); } public PlanesGenericCollection?this[string ind] { get { - if(_planeStorage.ContainsKey(ind)) - return _planeStorage[ind]; + PlanesCollectionInfo indObj = new PlanesCollectionInfo(ind, string.Empty); + if(_planeStorage.ContainsKey(indObj)) + return _planeStorage[indObj]; return null; } } diff --git a/AirBomber/AirBomber/SetGeneric.cs b/AirBomber/AirBomber/SetGeneric.cs index 4a99d44..db36bed 100644 --- a/AirBomber/AirBomber/SetGeneric.cs +++ b/AirBomber/AirBomber/SetGeneric.cs @@ -24,19 +24,26 @@ namespace ProjectAirBomber.Generics _places = new List(count); } - public void Insert(T plane) + public void SortSet(IComparer comparer) => _places.Sort(comparer); + + public void Insert(T plane, IEqualityComparer? equal = null) { if (_places.Count == _maxCount) throw new StorageOverflowException(_maxCount); - Insert(plane, 0); + Insert(plane, 0, equal); } - public void Insert(T plane, int position) + public void Insert(T plane, int position, IEqualityComparer? equal = null) { if (_places.Count == _maxCount) throw new StorageOverflowException(_maxCount); if (!(position >= 0 && position <= Count)) throw new Exception("Неверная позиция для вставки"); + if (equal != null) + { + if (_places.Contains(plane, equal)) + throw new ArgumentException(nameof(plane)); + } _places.Insert(position, plane); } public void Remove(int position) -- 2.25.1 From f9a3be739cbd49f3499d003c73b33ea824918b9d Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Wed, 20 Dec 2023 20:47:43 +0400 Subject: [PATCH 2/6] =?UTF-8?q?"...=20-=20=D1=8D=D1=82=D0=BE=20=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=B5..."=20-=20=D0=9D.=D0=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/PlanesCollectionInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AirBomber/AirBomber/PlanesCollectionInfo.cs b/AirBomber/AirBomber/PlanesCollectionInfo.cs index 411e88d..dca0629 100644 --- a/AirBomber/AirBomber/PlanesCollectionInfo.cs +++ b/AirBomber/AirBomber/PlanesCollectionInfo.cs @@ -17,6 +17,8 @@ namespace AirBomber } public bool Equals(PlanesCollectionInfo? other) { + if(other == null) + return false; return Name == other.Name; } public override int GetHashCode() -- 2.25.1 From f27b5455fcf6ddec53774bbd9fcd071bb0e9c386 Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Thu, 21 Dec 2023 12:36:40 +0400 Subject: [PATCH 3/6] =?UTF-8?q?-=D0=A0=D0=B0=D1=85=D0=BC=D0=B5=D1=82!=20-?= =?UTF-8?q?=20=D1=81=D0=BA=D0=B0=D0=B7=D0=B0=D0=BB=D0=B0=20=D0=90=D0=BB?= =?UTF-8?q?=D0=B8=D1=81=D0=B0.=20-=D0=9A=D0=B5=D1=84=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5...=20-=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=9A=D1=80=D0=BE=D0=BB=D0=B8=D0=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirBomber/FormPlaneCollection.Designer.cs | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs index e90ad52..7f1f1bb 100644 --- a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs +++ b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs @@ -32,8 +32,8 @@ namespace ProjectAirBomber { pictureBoxCollection = new PictureBox(); groupBoxTools = new GroupBox(); - button2 = new Button(); - button1 = new Button(); + buttonSortByColor = new Button(); + buttonSortByType = new Button(); GroupBoxSets = new GroupBox(); buttonDelObject = new Button(); buttonAddObject = new Button(); @@ -67,8 +67,8 @@ namespace ProjectAirBomber // groupBoxTools // groupBoxTools.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; - groupBoxTools.Controls.Add(button2); - groupBoxTools.Controls.Add(button1); + groupBoxTools.Controls.Add(buttonSortByColor); + groupBoxTools.Controls.Add(buttonSortByType); groupBoxTools.Controls.Add(GroupBoxSets); groupBoxTools.Controls.Add(ButtonRefreshCollection); groupBoxTools.Controls.Add(ButtonRemovePlane); @@ -81,25 +81,25 @@ namespace ProjectAirBomber groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; // - // button2 + // buttonSortByColor // - button2.Location = new Point(12, 375); - button2.Name = "button2"; - button2.Size = new Size(190, 29); - button2.TabIndex = 6; - button2.Text = "Сортировка по цвету"; - button2.UseVisualStyleBackColor = true; - button2.Click += ButtonSortByColor_Click; + buttonSortByColor.Location = new Point(12, 375); + buttonSortByColor.Name = "buttonSortByColor"; + buttonSortByColor.Size = new Size(190, 29); + buttonSortByColor.TabIndex = 6; + buttonSortByColor.Text = "Сортировка по цвету"; + buttonSortByColor.UseVisualStyleBackColor = true; + buttonSortByColor.Click += ButtonSortByColor_Click; // - // button1 + // buttonSortByType // - button1.Location = new Point(11, 340); - button1.Name = "button1"; - button1.Size = new Size(190, 29); - button1.TabIndex = 5; - button1.Text = "Сортировка по типу"; - button1.UseVisualStyleBackColor = true; - button1.Click += ButtonSortByType_Click; + buttonSortByType.Location = new Point(11, 340); + buttonSortByType.Name = "buttonSortByType"; + buttonSortByType.Size = new Size(190, 29); + buttonSortByType.TabIndex = 5; + buttonSortByType.Text = "Сортировка по типу"; + buttonSortByType.UseVisualStyleBackColor = true; + buttonSortByType.Click += ButtonSortByType_Click; // // GroupBoxSets // @@ -271,7 +271,7 @@ namespace ProjectAirBomber private ToolStripMenuItem ToolStripMenuItem; private ToolStripMenuItem SaveToolStripMenuItem; private ToolStripMenuItem LoadToolStripMenuItem; - private Button button2; - private Button button1; + private Button buttonSortByColor; + private Button buttonSortByType; } } \ No newline at end of file -- 2.25.1 From ef494f878d64cff529329a720eddf5ace2d5f8f0 Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Fri, 22 Dec 2023 09:18:11 +0400 Subject: [PATCH 4/6] =?UTF-8?q?"=D0=AD-=D1=8D-=D1=8D=20=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B1=D0=BE=D0=B9,=20=D0=B4=D0=B0=D0=B2=D0=B0=D0=B9=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BC=D0=B5=D1=87=D0=B0=D1=85=20=D1=81=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B0=D1=86=D0=B0!"=20-=20=D0=A1=D1=83=D0=BD=D1=8C=20?= =?UTF-8?q?=D0=A6=D0=B7=D1=8B,=20"=D0=98=D1=81=D0=BA=D1=83=D1=81=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE=20=D0=B2=D0=BE=D0=B9=D0=BD=D1=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/PlanesGenericStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AirBomber/AirBomber/PlanesGenericStorage.cs b/AirBomber/AirBomber/PlanesGenericStorage.cs index 45e13d7..cb4ff39 100644 --- a/AirBomber/AirBomber/PlanesGenericStorage.cs +++ b/AirBomber/AirBomber/PlanesGenericStorage.cs @@ -138,4 +138,4 @@ namespace ProjectAirBomber.Generics } } } -} +} \ No newline at end of file -- 2.25.1 From 1611aaf94c95eb25ac570c05d2d0f6fb4407e04a Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Fri, 22 Dec 2023 16:45:57 +0400 Subject: [PATCH 5/6] =?UTF-8?q?=D0=90=D0=BD=D1=82=D1=83=D0=B0=D0=BD=20?= =?UTF-8?q?=D0=B4=D0=B5=20=D0=A1=D0=B5=D0=BD=D1=82-=D0=AD=D0=BA=D0=B7?= =?UTF-8?q?=D1=8E=D0=BF=D0=B5=D1=80=D0=B8,=20"=D0=9C=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8C=D0=BA=D0=B8=D0=B9=20=D0=BF=D1=80=D0=B8=D0=B5=D1=86?= =?UTF-8?q?"(=D0=98=D1=88=D0=B5=D0=B5=D0=B2=D0=BA=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/PlanesCollectionInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AirBomber/AirBomber/PlanesCollectionInfo.cs b/AirBomber/AirBomber/PlanesCollectionInfo.cs index dca0629..1e57a61 100644 --- a/AirBomber/AirBomber/PlanesCollectionInfo.cs +++ b/AirBomber/AirBomber/PlanesCollectionInfo.cs @@ -17,8 +17,8 @@ namespace AirBomber } public bool Equals(PlanesCollectionInfo? other) { - if(other == null) - return false; + if (other == null) + throw new ArgumentNullException(nameof(other)); return Name == other.Name; } public override int GetHashCode() -- 2.25.1 From e609ddf4653a5ad50b5c39d9e52bc070fbc59e52 Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Fri, 22 Dec 2023 16:50:13 +0400 Subject: [PATCH 6/6] =?UTF-8?q?=D0=92=D0=B5=D1=81=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B2=D1=8B=D0=BC=20=D0=B4=D0=B5=D0=BB=D0=BE?= =?UTF-8?q?=D0=BC=20=D1=80=D0=B0=D1=81=D1=86=D0=B2=D0=B5=D0=BB=20=D0=90?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=92=D0=90=D0=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/PlanesCollectionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AirBomber/AirBomber/PlanesCollectionInfo.cs b/AirBomber/AirBomber/PlanesCollectionInfo.cs index 1e57a61..1d22f93 100644 --- a/AirBomber/AirBomber/PlanesCollectionInfo.cs +++ b/AirBomber/AirBomber/PlanesCollectionInfo.cs @@ -17,7 +17,7 @@ namespace AirBomber } public bool Equals(PlanesCollectionInfo? other) { - if (other == null) + if (other == null || other.Name == null) throw new ArgumentNullException(nameof(other)); return Name == other.Name; } -- 2.25.1