diff --git a/ProjectMotorboat/ProjectMotorboat/BoatDelegate.cs b/ProjectMotorboat/ProjectMotorboat/BoatDelegate.cs index d7c5e5d..dc0416c 100644 --- a/ProjectMotorboat/ProjectMotorboat/BoatDelegate.cs +++ b/ProjectMotorboat/ProjectMotorboat/BoatDelegate.cs @@ -1,10 +1,4 @@ using ProjectMotorboat.Drownings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace ProjectMotorboat; public delegate void BoatDelegate(DrawningBoat car); \ No newline at end of file diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/AbstractCompany.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/AbstractCompany.cs index 7041dfa..707164c 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/AbstractCompany.cs @@ -1,4 +1,4 @@ -using ProjectMotorboat.CollectionGenericObjects; + using ProjectMotorboat.Drownings; using ProjectMotorboat.Exceptions; diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/CollectionType.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/CollectionType.cs index eb3ec09..0ba2999 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/CollectionType.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/CollectionType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectMotorboat.CollectionGenericObjects; +namespace ProjectMotorboat.CollectionGenericObjects; public enum CollectionType { diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ICollectionGenericObjects.cs index 155355d..9434625 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectMotorboat.CollectionGenericObjects; +namespace ProjectMotorboat.CollectionGenericObjects; public interface ICollectionGenericObjects diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ListGenericObjects.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ListGenericObjects.cs index 0de7f64..3b8480f 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ListGenericObjects.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/ListGenericObjects.cs @@ -1,26 +1,16 @@ using ProjectMotorboat.Exceptions; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace ProjectMotorboat.CollectionGenericObjects; public class ListGenericObjects : ICollectionGenericObjects where T : class { - /// - /// Список объектов, которые храним - /// + private readonly List _collection; public CollectionType GetCollectionType => CollectionType.List; - /// - /// Максимально допустимое число объектов в списке - /// + private int _maxCount; public int Count => _collection.Count; @@ -40,9 +30,6 @@ where T : class } } - /// - /// Конструктор - /// public ListGenericObjects() { _collection = new(); @@ -50,13 +37,11 @@ where T : class public T Get(int position) { - //TODO выброс ошибки если выход за границу if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); return _collection[position]; } public int Insert(T obj) { - // TODO выброс ошибки если переполнение if (Count == _maxCount) throw new CollectionOverflowException(Count); _collection.Add(obj); return Count; @@ -64,8 +49,6 @@ where T : class public int Insert(T obj, int position) { - // TODO выброс ошибки если переполнение - // TODO выброс ошибки если за границу if (Count == _maxCount) throw new CollectionOverflowException(Count); if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); _collection.Insert(position, obj); @@ -74,7 +57,6 @@ where T : class public T Remove(int position) { - // TODO если выброс за границу if (position >= _collection.Count || position < 0) throw new PositionOutOfCollectionException(position); T obj = _collection[position]; diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/MassiveGenericObjects.cs index bf145fa..fb824d5 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/MassiveGenericObjects.cs @@ -61,7 +61,6 @@ public class MassiveGenericObjects : ICollectionGenericObjects } public int Insert(T obj, int position) { - // проверка позиции if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position); if (_collection[position] != null) @@ -95,14 +94,11 @@ public class MassiveGenericObjects : ICollectionGenericObjects throw new CollectionOverflowException(Count); } } - - // вставка _collection[position] = obj; return position; } public T Remove(int position) { - // проверка позиции if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position); if (_collection[position] == null) throw new ObjectNotFoundException(position); diff --git a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/StorageCollection.cs b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/StorageCollection.cs index b5aab3c..93aaf8b 100644 --- a/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/StorageCollection.cs +++ b/ProjectMotorboat/ProjectMotorboat/CollectionGenericObjects/StorageCollection.cs @@ -1,11 +1,6 @@ using ProjectMotorboat.Drownings; using ProjectMotorboat.Exceptions; -using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; - namespace ProjectMotorboat.CollectionGenericObjects; public class StorageCollection diff --git a/ProjectMotorboat/ProjectMotorboat/Drownings/DirectionType.cs b/ProjectMotorboat/ProjectMotorboat/Drownings/DirectionType.cs index 1741509..8736b4f 100644 --- a/ProjectMotorboat/ProjectMotorboat/Drownings/DirectionType.cs +++ b/ProjectMotorboat/ProjectMotorboat/Drownings/DirectionType.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace ProjectMotorboat.Drownings { diff --git a/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs b/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs index 9c9321a..dfd9d01 100644 --- a/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs +++ b/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs @@ -1,9 +1,5 @@ using ProjectMotorboat.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace ProjectMotorboat.Drownings; @@ -114,28 +110,28 @@ public class DrawningBoat } switch (direction) { - //влево + case DirectionType.Left: if (_startPosX.Value - EntityBoat.Step > 0) { _startPosX -= (int)EntityBoat.Step; } return true; - //вверх + case DirectionType.Up: if (_startPosY.Value - EntityBoat.Step > 0) { _startPosY -= (int)EntityBoat.Step; } return true; - // вправо + case DirectionType.Right: if (_startPosX.Value + EntityBoat.Step + _drawningBoatWidth < _pictureWidth) { _startPosX += (int)EntityBoat.Step; } return true; - //вниз + case DirectionType.Down: if (_startPosY.Value + EntityBoat.Step + _drawningBoatHeight < _pictureHeight) { @@ -155,7 +151,7 @@ public class DrawningBoat Pen pen = new(Color.Black); Brush mainBrush = new SolidBrush(EntityBoat.BodyColor); - // корпус + Point[] hull = new Point[] { new Point(_startPosX.Value + 5, _startPosY.Value + 0), @@ -167,7 +163,7 @@ public class DrawningBoat g.FillPolygon(mainBrush, hull); g.DrawPolygon(pen, hull); - // основная часть + Brush blockBrush = new SolidBrush(EntityBoat.BodyColor); g.FillRectangle(blockBrush, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40); g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40); diff --git a/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningMotorboat.cs b/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningMotorboat.cs index fcda9e0..3c5a389 100644 --- a/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningMotorboat.cs +++ b/ProjectMotorboat/ProjectMotorboat/Drownings/DrawningMotorboat.cs @@ -26,15 +26,12 @@ public class DrawningMotorboat : DrawningBoat Brush additionalBrush = new SolidBrush(motorboat.AdditionalColor); base.DrawTransport(g); - - // стекло впереди if (motorboat.Glass) { Brush glassBrush = new SolidBrush(Color.LightBlue); g.FillEllipse(glassBrush, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40); g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40); } - // двигатель if (motorboat.Motor) { Brush engineBrush = new diff --git a/ProjectMotorboat/ProjectMotorboat/Drownings/ExtentionDrawningBoat.cs b/ProjectMotorboat/ProjectMotorboat/Drownings/ExtentionDrawningBoat.cs index 93a04ba..b100371 100644 --- a/ProjectMotorboat/ProjectMotorboat/Drownings/ExtentionDrawningBoat.cs +++ b/ProjectMotorboat/ProjectMotorboat/Drownings/ExtentionDrawningBoat.cs @@ -8,16 +8,8 @@ using System.Threading.Tasks; namespace ProjectMotorboat.Drownings; public static class ExtentionDrawningBoat { - /// - /// Разделитель для записи информации по объекту в файл - /// private static readonly string _separatorForObject = ":"; - /// - /// Создание объекта из строки - /// - /// - /// public static DrawningBoat? CreateDrawningBoat(this string info) { string[] strs = info.Split(_separatorForObject); @@ -34,12 +26,6 @@ public static class ExtentionDrawningBoat } return null; } - - /// - /// Получение данных для сохранения в файл - /// - /// - /// public static string GetDataForSave(this DrawningBoat drawningBoat) { string[]? array = drawningBoat?.EntityBoat?.GetStringRepresentation(); diff --git a/ProjectMotorboat/ProjectMotorboat/FormBoatCollection.cs b/ProjectMotorboat/ProjectMotorboat/FormBoatCollection.cs index cb88150..c11963e 100644 --- a/ProjectMotorboat/ProjectMotorboat/FormBoatCollection.cs +++ b/ProjectMotorboat/ProjectMotorboat/FormBoatCollection.cs @@ -1,8 +1,6 @@ using Microsoft.Extensions.Logging; using ProjectMotorboat.CollectionGenericObjects; using ProjectMotorboat.Drownings; -using ProjectMotorboat.Exceptions; -using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; namespace ProjectMotorboat; diff --git a/ProjectMotorboat/ProjectMotorboat/FormBoatConfig.cs b/ProjectMotorboat/ProjectMotorboat/FormBoatConfig.cs index cdcba04..9f80f39 100644 --- a/ProjectMotorboat/ProjectMotorboat/FormBoatConfig.cs +++ b/ProjectMotorboat/ProjectMotorboat/FormBoatConfig.cs @@ -1,15 +1,5 @@ using ProjectMotorboat.Drownings; using ProjectMotorboat.Entities; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - namespace ProjectMotorboat { public partial class FormBoatConfig : Form @@ -81,11 +71,9 @@ namespace ProjectMotorboat private void Panel_MouseDown(object? sender, MouseEventArgs e) { - // TODO отправка цвета в Drag&Drop (sender as Control)?.DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy); } - // Логика смены цветов: основного и дополнительного (для продвинутого объекта) private void LabelBodyColor_DragEnter(object sender, DragEventArgs e) { if (e.Data?.GetDataPresent(typeof(Color)) ?? false) diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/AbstractStrategy.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/AbstractStrategy.cs index 3a1d329..dff9ae5 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/AbstractStrategy.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/AbstractStrategy.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace ProjectMotorboat.MovementStrategy; diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/IMoveableObject.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/IMoveableObject.cs index 898afa6..593b279 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/IMoveableObject.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/IMoveableObject.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace ProjectMotorboat.MovementStrategy; diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToBorder.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToBorder.cs index 3da281d..03b0866 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToBorder.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToBorder.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace ProjectMotorboat.MovementStrategy; public class MoveToBorder : AbstractStrategy diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToCenter.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToCenter.cs index 08b425a..7538fc1 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToCenter.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveToCenter.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace ProjectMotorboat.MovementStrategy; public class MoveToCenter : AbstractStrategy { diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveableBoat.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveableBoat.cs index 6e59fee..0b43cfe 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveableBoat.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MoveableBoat.cs @@ -1,9 +1,5 @@ using ProjectMotorboat.Drownings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + namespace ProjectMotorboat.MovementStrategy; diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MovementDirection.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MovementDirection.cs index 329e8d9..a79ea1f 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MovementDirection.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/MovementDirection.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectMotorboat.MovementStrategy; +namespace ProjectMotorboat.MovementStrategy; public enum MovementDirection { diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/ObjectParameters.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/ObjectParameters.cs index 51bb02b..254e951 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/ObjectParameters.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/ObjectParameters.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectMotorboat.MovementStrategy; +namespace ProjectMotorboat.MovementStrategy; public class ObjectParameters { diff --git a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/StrategyStatus.cs b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/StrategyStatus.cs index e4b58f8..85a9fc8 100644 --- a/ProjectMotorboat/ProjectMotorboat/MovementStrategy/StrategyStatus.cs +++ b/ProjectMotorboat/ProjectMotorboat/MovementStrategy/StrategyStatus.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace ProjectMotorboat.MovementStrategy; public enum StrategyStatus diff --git a/ProjectMotorboat/ProjectMotorboat/Program.cs b/ProjectMotorboat/ProjectMotorboat/Program.cs index 709fd90..35730ce 100644 --- a/ProjectMotorboat/ProjectMotorboat/Program.cs +++ b/ProjectMotorboat/ProjectMotorboat/Program.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using NLog.Extensions.Logging; using Serilog; namespace ProjectMotorboat;