From bcbc9f28b8bec665cb887fd69d3f4ea6377930de Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 16 May 2024 05:12:44 +0300 Subject: [PATCH] LabWork08 --- .../AbstractCompany.cs | 7 ++- .../ICollectionGenericObjects.cs | 16 ++++- .../ListGenericObjects.cs | 35 ++++++++++- .../MassiveGenericObjects.cs | 34 ++++++++++- .../DrawingWarshipCompareByColor.cs | 37 ++++++++++++ .../DrawingWarshipCompareByType.cs | 32 ++++++++++ .../DrawingObject/DrawingWarshipEquitables.cs | 59 +++++++++++++++++++ .../CollectionAlreadyExistsException.cs | 12 ++++ .../Exceptions/CollectionInfoException.cs | 13 ++++ .../Exceptions/CollectionInsertException.cs | 14 +++++ .../Exceptions/CollectionTypeException.cs | 13 ++++ .../Exceptions/DrawingEquitablesException.cs | 13 ++++ .../Exceptions/EmptyFileExeption.cs | 14 +++++ .../Exceptions/FileFormatException.cs | 13 ++++ .../Exceptions/FileNotFoundException.cs | 14 +++++ .../FormWarshipCollection.Designer.cs | 29 +++------ .../AbstractStrategy.cs | 0 .../{ => MovementStrategy}/IMoveableObject.cs | 0 .../{ => MovementStrategy}/MoveToBorder.cs | 0 .../{ => MovementStrategy}/MoveToCenter.cs | 0 .../{ => MovementStrategy}/MoveableWarship.cs | 0 .../MovementDirection.cs | 0 .../ObjectParameters.cs | 0 .../{ => MovementStrategy}/StrategyStatus.cs | 0 24 files changed, 326 insertions(+), 29 deletions(-) create mode 100644 ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByColor.cs create mode 100644 ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByType.cs create mode 100644 ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipEquitables.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/CollectionAlreadyExistsException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/CollectionInfoException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/CollectionInsertException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/CollectionTypeException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/DrawingEquitablesException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/EmptyFileExeption.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/FileFormatException.cs create mode 100644 ProjectBattleship/ProjectBattleship/Exceptions/FileNotFoundException.cs rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/AbstractStrategy.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/IMoveableObject.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/MoveToBorder.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/MoveToCenter.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/MoveableWarship.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/MovementDirection.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/ObjectParameters.cs (100%) rename ProjectBattleship/ProjectBattleship/{ => MovementStrategy}/StrategyStatus.cs (100%) diff --git a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/AbstractCompany.cs b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/AbstractCompany.cs index 2629ae6..5dd6c68 100644 --- a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/AbstractCompany.cs @@ -55,7 +55,7 @@ public abstract class AbstractCompany public static int operator +(AbstractCompany company, DrawingWarship warship) { - return company._collection?.Insert(warship) ?? 0; + return company._collection?.Insert(warship, new DrawiningWarshipEqutables()) ?? 0; } /// /// Перегрузка оператора удаления для класса @@ -78,6 +78,11 @@ public abstract class AbstractCompany return _collection?.Get(rnd.Next(GetMaxCount)); } /// + /// Сортировка + /// + /// Сравнитель объектов + public void Sort(IComparer comparer) => _collection?.CollectionSort(comparer); + /// /// Вывод всей коллекции /// /// diff --git a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ICollectionGenericObjects.cs index 21ad617..821add1 100644 --- a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -1,4 +1,6 @@ -namespace ProjectBattleship.CollectionGenericObjects; +using ProjectBattleship.DrawingObject; + +namespace ProjectBattleship.CollectionGenericObjects; /// /// Интерфейс описания действий для набора хранимых объектов /// @@ -20,16 +22,18 @@ where T : class /// Добавление объекта в коллекцию /// /// Добавляемый объект + /// Сравнение двух объектов /// true - вставка прошла удачно, false - вставка не удалась - int Insert(T obj); + int Insert(T obj, IEqualityComparer? comparer = null); /// /// Добавление объекта в коллекцию на конкретную позицию /// /// Добавляемый объект /// Позиция + /// Сравнение двух объектов /// true - вставка прошла удачно, false - вставка не удалась - int Insert(T obj, int position); + int Insert(T obj, int position, IEqualityComparer? comparer = null); /// /// Удаление объекта из коллекции с конкретной позиции @@ -55,4 +59,10 @@ where T : class /// /// Поэлементый вывод элементов коллекции IEnumerable GetItems(); + + /// + /// Сортировка коллекции + /// + /// Сравнитель объектов + void CollectionSort(IComparer comparer); } \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ListGenericObjects.cs b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ListGenericObjects.cs index cc604f8..69193fd 100644 --- a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ListGenericObjects.cs +++ b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/ListGenericObjects.cs @@ -1,4 +1,5 @@ using ProjectBattleship.CollectionGenericObjects; +using ProjectBattleship.DrawingObject; using ProjectBattleship.Exceptions; @@ -52,17 +53,42 @@ where T : class return _collection[position]; } - public int Insert(T obj) + public int Insert(T obj, IEqualityComparer? comparer = null) { if (Count == _maxCount) throw new CollectionOverflowException(Count); + + if (comparer != null) + { + for (int i = 0; i < Count; i++) + { + if (comparer.Equals(_collection[i], obj)) + { + throw new CollectionInsertException(obj); + } + } + } + _collection.Add(obj); return Count; } - public int Insert(T obj, int position) + public int Insert(T obj, int position, IEqualityComparer? comparer = null) { if (Count == _maxCount) throw new CollectionOverflowException(Count); if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); + + if (comparer != null) + { + for (int i = 0; i < Count; i++) + { + if (comparer.Equals(_collection[i], obj)) + { + throw new CollectionInsertException(obj); + } + } + } + + _collection.Insert(position, obj); return position; } @@ -82,4 +108,9 @@ where T : class yield return _collection[i]; } } + + public void CollectionSort(IComparer comparer) + { + _collection.Sort(comparer); + } } \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/MassiveGenericObjects.cs index 913bfc2..0b7b054 100644 --- a/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectBattleship/ProjectBattleship/CollectionGenericObjects/MassiveGenericObjects.cs @@ -1,5 +1,6 @@ using ProjectBattleship.Exceptions; using ProjectBattleship.CollectionGenericObjects; +using ProjectBattleship.DrawingObject; namespace Battleship.CollectionGenericObjects; /// @@ -60,8 +61,19 @@ public class MassiveGenericObjects : ICollectionGenericObjects return _collection[position]; } - public int Insert(T obj) + public int Insert(T obj, IEqualityComparer? comparer = null) { + if (comparer != null) + { + for (int i = 0; i < Count; i++) + { + if (comparer.Equals(_collection[i], obj)) + { + throw new CollectionInsertException(obj); + } + } + } + // вставка в свободное место набора for (int i = 0; i < Count; i++) { @@ -75,11 +87,22 @@ public class MassiveGenericObjects : ICollectionGenericObjects throw new CollectionOverflowException(Count); } - public int Insert(T obj, int position) + public int Insert(T obj, int position, IEqualityComparer? comparer = null) { // проверка позиции if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position); + if (comparer != null) + { + for (int i = 0; i < Count; i++) + { + if (comparer.Equals(_collection[i], obj)) + { + throw new CollectionInsertException(obj); + } + } + } + if (_collection[position] != null) { bool pushed = false; @@ -135,4 +158,11 @@ public class MassiveGenericObjects : ICollectionGenericObjects yield return _collection[i]; } } + + public void CollectionSort(IComparer comparer) + { + List value = new List(_collection); + value.Sort(comparer); + value.CopyTo(_collection, 0); + } } \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByColor.cs b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByColor.cs new file mode 100644 index 0000000..e480ffd --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByColor.cs @@ -0,0 +1,37 @@ +using ProjectBattleship.DrawingObject; +namespace Battleship; + +public class DrawingWarshipCompareByColor : IComparer +{ + public int Compare(DrawingWarship? x, DrawingWarship? y) + { + if (x == null && y == null) return 0; + if (x == null || x.EntityWarship == null) + { + return 1; + } + + if (y == null || y.EntityWarship == null) + { + return -1; + } + + if (ToHex(x.EntityWarship.BodyColor) != ToHex(y.EntityWarship.BodyColor)) + { + return String.Compare(ToHex(x.EntityWarship.BodyColor), ToHex(y.EntityWarship.BodyColor), + StringComparison.Ordinal); + } + + var speedCompare = x.EntityWarship.Speed.CompareTo(y.EntityWarship.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + + return x.EntityWarship.Weight.CompareTo(y.EntityWarship.Weight); + } + + private static String ToHex(Color c) + => $"#{c.R:X2}{c.G:X2}{c.B:X2}"; +} + diff --git a/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByType.cs b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByType.cs new file mode 100644 index 0000000..763b300 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipCompareByType.cs @@ -0,0 +1,32 @@ +using ProjectBattleship.DrawingObject; +namespace Battleship; + +public class DrawingWarshipCompareByType : IComparer +{ + public int Compare(DrawingWarship? x, DrawingWarship? y) + { + if (x == null && y == null) return 0; + if (x == null || x.EntityWarship == null) + { + return 1; + } + + if (y == null || y.EntityWarship == null) + { + return -1; + } + + if (x.GetType().Name != y.GetType().Name) + { + return x.GetType().Name.CompareTo(y.GetType().Name); + } + + var speedCompare = x.EntityWarship.Speed.CompareTo(y.EntityWarship.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + + return x.EntityWarship.Weight.CompareTo(y.EntityWarship.Weight); + } +} \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipEquitables.cs b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipEquitables.cs new file mode 100644 index 0000000..366b193 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/DrawingObject/DrawingWarshipEquitables.cs @@ -0,0 +1,59 @@ +using ProjectBattleship.Entities; +using System.Diagnostics.CodeAnalysis; +namespace ProjectBattleship.DrawingObject; +/// +/// Реализация сравнения двух объектов класса-прорисовки +/// +public class DrawiningWarshipEqutables : IEqualityComparer +{ + public bool Equals(DrawingWarship? x, DrawingWarship? y) + { + if (x == null || x.EntityWarship == null) + { + return false; + } + if (y == null || y.EntityWarship == null) + { + return false; + } + if (x.GetType().Name != y.GetType().Name) + { + return false; + } + if (x.EntityWarship.Speed != y.EntityWarship.Speed) + { + return false; + } + if (x.EntityWarship.Weight != y.EntityWarship.Weight) + { + return false; + } + if (x.EntityWarship.BodyColor != y.EntityWarship.BodyColor) + { + return false; + } + if (x is DrawingBattleship && y is DrawingBattleship) + { + if (((EntityBattleship)x.EntityWarship).AdditionalColor != + ((EntityBattleship)y.EntityWarship).AdditionalColor) + { + return false; + } + if (((EntityBattleship)x.EntityWarship).RocketCompartment != + ((EntityBattleship)y.EntityWarship).RocketCompartment) + { + return false; + } + if (((EntityBattleship)x.EntityWarship).Turret != + ((EntityBattleship)y.EntityWarship).Turret) + { + return false; + } + } + return true; + } + public int GetHashCode([DisallowNull] DrawingWarship obj) + { + return obj.GetHashCode(); + } +} diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/CollectionAlreadyExistsException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionAlreadyExistsException.cs new file mode 100644 index 0000000..f9fa8a4 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionAlreadyExistsException.cs @@ -0,0 +1,12 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; +public class CollectionAlreadyExistsException : Exception +{ + public CollectionAlreadyExistsException() : base() { } + public CollectionAlreadyExistsException(CollectionInfo collectionInfo) : base($"Коллекция {collectionInfo} уже существует!") { } + public CollectionAlreadyExistsException(string name, Exception exception) : + base($"Коллекция {name} уже существует!", exception) + { } + protected CollectionAlreadyExistsException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInfoException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInfoException.cs new file mode 100644 index 0000000..49629d3 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInfoException.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class CollectionInfoException : Exception +{ + public CollectionInfoException() : base() { } + public CollectionInfoException(string message) : base(message) { } + public CollectionInfoException(string message, Exception exception) : + base(message, exception) + { } + protected CollectionInfoException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInsertException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInsertException.cs new file mode 100644 index 0000000..77d5bec --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionInsertException.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class CollectionInsertException : Exception +{ + public CollectionInsertException(object obj) : base($"Объект {obj} не удволетворяет уникальности") { } + public CollectionInsertException() : base() { } + public CollectionInsertException(string message) : base(message) { } + public CollectionInsertException(string message, Exception exception) : + base(message, exception) + { } + protected CollectionInsertException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/CollectionTypeException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionTypeException.cs new file mode 100644 index 0000000..4172ad3 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/CollectionTypeException.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class CollectionTypeException : Exception +{ + public CollectionTypeException() : base() { } + public CollectionTypeException(string message) : base(message) { } + public CollectionTypeException(string message, Exception exception) : + base(message, exception) + { } + protected CollectionTypeException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/DrawingEquitablesException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/DrawingEquitablesException.cs new file mode 100644 index 0000000..38b75a9 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/DrawingEquitablesException.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class DrawningEquitablesException : Exception +{ + public DrawningEquitablesException() : base("Объекты прорисовки одинаковые") { } + public DrawningEquitablesException(string message) : base(message) { } + public DrawningEquitablesException(string message, Exception exception) : + base(message, exception) + { } + protected DrawningEquitablesException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/EmptyFileExeption.cs b/ProjectBattleship/ProjectBattleship/Exceptions/EmptyFileExeption.cs new file mode 100644 index 0000000..87539db --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/EmptyFileExeption.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class EmptyFileExeption : Exception +{ + public EmptyFileExeption(string name) : base($"Файл {name} пустой ") { } + public EmptyFileExeption() : base("В хранилище отсутствуют коллекции для сохранения") { } + public EmptyFileExeption(string name, string message) : base(message) { } + public EmptyFileExeption(string name, string message, Exception exception) : + base(message, exception) + { } + protected EmptyFileExeption(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/FileFormatException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/FileFormatException.cs new file mode 100644 index 0000000..f52acb8 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/FileFormatException.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class FileFormatException : Exception +{ + public FileFormatException() : base() { } + public FileFormatException(string message) : base(message) { } + public FileFormatException(string name, Exception exception) : + base($"Файл {name} имеет неверный формат. Ошибка: {exception.Message}", exception) + { } + protected FileFormatException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/Exceptions/FileNotFoundException.cs b/ProjectBattleship/ProjectBattleship/Exceptions/FileNotFoundException.cs new file mode 100644 index 0000000..6981a38 --- /dev/null +++ b/ProjectBattleship/ProjectBattleship/Exceptions/FileNotFoundException.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; +namespace ProjectBattleship.Exceptions; + +public class FileNotFoundException : Exception +{ + public FileNotFoundException(string name) : base($"Файл {name} не существует ") { } + public FileNotFoundException() : base() { } + public FileNotFoundException(string name, string message) : base(message) { } + public FileNotFoundException(string name, string message, Exception exception) : + base(message, exception) + { } + protected FileNotFoundException(SerializationInfo info, StreamingContext + contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs b/ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs index 68d4fd7..c1efc3d 100644 --- a/ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs +++ b/ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs @@ -33,7 +33,6 @@ namespace ProjectBattleship groupBoxCollectionTools = new GroupBox(); panelCompanyTools = new Panel(); buttonRefresh = new Button(); - buttonAddBattleship = new Button(); maskedTextBoxPosition = new MaskedTextBox(); buttonAddWarship = new Button(); buttonGoToCheck = new Button(); @@ -71,7 +70,7 @@ namespace ProjectBattleship groupBoxCollectionTools.Controls.Add(panelCollection); groupBoxCollectionTools.Location = new Point(699, 27); groupBoxCollectionTools.Name = "groupBoxCollectionTools"; - groupBoxCollectionTools.Size = new Size(279, 618); + groupBoxCollectionTools.Size = new Size(279, 653); groupBoxCollectionTools.TabIndex = 1; groupBoxCollectionTools.TabStop = false; groupBoxCollectionTools.Text = "Инструменты"; @@ -79,7 +78,6 @@ namespace ProjectBattleship // panelCompanyTools // panelCompanyTools.Controls.Add(buttonRefresh); - panelCompanyTools.Controls.Add(buttonAddBattleship); panelCompanyTools.Controls.Add(maskedTextBoxPosition); panelCompanyTools.Controls.Add(buttonAddWarship); panelCompanyTools.Controls.Add(buttonGoToCheck); @@ -87,12 +85,12 @@ namespace ProjectBattleship panelCompanyTools.Enabled = false; panelCompanyTools.Location = new Point(6, 354); panelCompanyTools.Name = "panelCompanyTools"; - panelCompanyTools.Size = new Size(267, 234); + panelCompanyTools.Size = new Size(267, 208); panelCompanyTools.TabIndex = 11; // // buttonRefresh // - buttonRefresh.Location = new Point(8, 203); + buttonRefresh.Location = new Point(8, 163); buttonRefresh.Name = "buttonRefresh"; buttonRefresh.Size = new Size(251, 34); buttonRefresh.TabIndex = 7; @@ -100,19 +98,9 @@ namespace ProjectBattleship buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.Click += ButtonRefresh_Click; // - // buttonAddBattleship - // - buttonAddBattleship.Location = new Point(8, 46); - buttonAddBattleship.Name = "buttonAddBattleship"; - buttonAddBattleship.Size = new Size(251, 34); - buttonAddBattleship.TabIndex = 3; - buttonAddBattleship.Text = "Добавить линкор"; - buttonAddBattleship.UseVisualStyleBackColor = true; - buttonAddBattleship.Click += ButtonAddBattleship_Click; - // // maskedTextBoxPosition // - maskedTextBoxPosition.Location = new Point(8, 86); + maskedTextBoxPosition.Location = new Point(8, 46); maskedTextBoxPosition.Mask = "00"; maskedTextBoxPosition.Name = "maskedTextBoxPosition"; maskedTextBoxPosition.Size = new Size(251, 31); @@ -131,7 +119,7 @@ namespace ProjectBattleship // // buttonGoToCheck // - buttonGoToCheck.Location = new Point(8, 163); + buttonGoToCheck.Location = new Point(8, 123); buttonGoToCheck.Name = "buttonGoToCheck"; buttonGoToCheck.Size = new Size(251, 34); buttonGoToCheck.TabIndex = 6; @@ -141,7 +129,7 @@ namespace ProjectBattleship // // buttonRemoveWarship // - buttonRemoveWarship.Location = new Point(8, 123); + buttonRemoveWarship.Location = new Point(8, 83); buttonRemoveWarship.Name = "buttonRemoveWarship"; buttonRemoveWarship.Size = new Size(251, 34); buttonRemoveWarship.TabIndex = 5; @@ -256,7 +244,7 @@ namespace ProjectBattleship pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; pictureBox.Location = new Point(0, 51); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(688, 567); + pictureBox.Size = new Size(688, 602); pictureBox.TabIndex = 2; pictureBox.TabStop = false; // @@ -305,7 +293,7 @@ namespace ProjectBattleship // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(978, 618); + ClientSize = new Size(978, 653); Controls.Add(groupBoxCollectionTools); Controls.Add(pictureBox); Controls.Add(menuStrip); @@ -326,7 +314,6 @@ namespace ProjectBattleship #endregion private GroupBox groupBoxCollectionTools; - private Button buttonAddBattleship; private Button buttonAddWarship; private ComboBox comboBoxSelectorCompany; private Button buttonRefresh; diff --git a/ProjectBattleship/ProjectBattleship/AbstractStrategy.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/AbstractStrategy.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/AbstractStrategy.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/AbstractStrategy.cs diff --git a/ProjectBattleship/ProjectBattleship/IMoveableObject.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/IMoveableObject.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/IMoveableObject.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/IMoveableObject.cs diff --git a/ProjectBattleship/ProjectBattleship/MoveToBorder.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/MoveToBorder.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/MoveToBorder.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/MoveToBorder.cs diff --git a/ProjectBattleship/ProjectBattleship/MoveToCenter.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/MoveToCenter.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/MoveToCenter.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/MoveToCenter.cs diff --git a/ProjectBattleship/ProjectBattleship/MoveableWarship.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/MoveableWarship.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/MoveableWarship.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/MoveableWarship.cs diff --git a/ProjectBattleship/ProjectBattleship/MovementDirection.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/MovementDirection.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/MovementDirection.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/MovementDirection.cs diff --git a/ProjectBattleship/ProjectBattleship/ObjectParameters.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/ObjectParameters.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/ObjectParameters.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/ObjectParameters.cs diff --git a/ProjectBattleship/ProjectBattleship/StrategyStatus.cs b/ProjectBattleship/ProjectBattleship/MovementStrategy/StrategyStatus.cs similarity index 100% rename from ProjectBattleship/ProjectBattleship/StrategyStatus.cs rename to ProjectBattleship/ProjectBattleship/MovementStrategy/StrategyStatus.cs