This commit is contained in:
Слава 2024-06-03 03:24:59 +04:00
parent eed42ea361
commit d4623e82cd
35 changed files with 331 additions and 320 deletions

View File

@ -1,7 +1,7 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
using ProjectCruiser.Exceptions; using ProjectPlane.Exceptions;
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Абстракция компании, хранящий коллекцию автомобилей /// Абстракция компании, хранящий коллекцию автомобилей
@ -29,9 +29,9 @@ namespace ProjectCruiser.CollectionGenericObjects
protected readonly int _pictureHeight; protected readonly int _pictureHeight;
/// <summary> /// <summary>
/// Коллекция крейсеров /// Коллекция самолетов
/// </summary> /// </summary>
protected ICollectionGenericObjects<DrawningCruiser>? _collection = null; protected ICollectionGenericObjects<DrawningPlane>? _collection = null;
/// <summary> /// <summary>
/// Вычисление максимального количества элементов, который можно разместить в окне /// Вычисление максимального количества элементов, который можно разместить в окне
@ -45,7 +45,7 @@ namespace ProjectCruiser.CollectionGenericObjects
/// <param name="picHeight">Высота окна</param> /// <param name="picHeight">Высота окна</param>
/// <param name="collection">Коллекция автомобилей</param> /// <param name="collection">Коллекция автомобилей</param>
public AbstractCompany(int picWidth, int picHeight, public AbstractCompany(int picWidth, int picHeight,
ICollectionGenericObjects<DrawningCruiser> collection) ICollectionGenericObjects<DrawningPlane> collection)
{ {
_pictureWidth = picWidth; _pictureWidth = picWidth;
_pictureHeight = picHeight; _pictureHeight = picHeight;
@ -59,7 +59,7 @@ namespace ProjectCruiser.CollectionGenericObjects
/// <param name="company">Компания</param> /// <param name="company">Компания</param>
/// <param name="сruiser">Добавляемый объект</param> /// <param name="сruiser">Добавляемый объект</param>
/// <returns></returns> /// <returns></returns>
public static int operator +(AbstractCompany company, DrawningCruiser сruiser) public static int operator +(AbstractCompany company, DrawningPlane сruiser)
{ {
return company._collection.Insert(сruiser); return company._collection.Insert(сruiser);
} }
@ -70,7 +70,7 @@ namespace ProjectCruiser.CollectionGenericObjects
/// <param name="company">Компания</param> /// <param name="company">Компания</param>
/// <param name="position">Номер удаляемого объекта</param> /// <param name="position">Номер удаляемого объекта</param>
/// <returns></returns> /// <returns></returns>
public static DrawningCruiser operator -(AbstractCompany company, int position) public static DrawningPlane operator -(AbstractCompany company, int position)
{ {
return company._collection?.Remove(position); return company._collection?.Remove(position);
} }
@ -79,7 +79,7 @@ namespace ProjectCruiser.CollectionGenericObjects
/// Получение случайного объекта из коллекции /// Получение случайного объекта из коллекции
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DrawningCruiser? GetRandomObject() public DrawningPlane? GetRandomObject()
{ {
Random rnd = new(); Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount)); return _collection?.Get(rnd.Next(GetMaxCount));
@ -99,7 +99,7 @@ namespace ProjectCruiser.CollectionGenericObjects
{ {
try try
{ {
DrawningCruiser? obj = _collection?.Get(i); DrawningPlane? obj = _collection?.Get(i);
obj?.DrawTransport(graphics); obj?.DrawTransport(graphics);
} }
catch (ObjectNotFoundException e) catch (ObjectNotFoundException e)

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
public enum CollectionType public enum CollectionType
{ {

View File

@ -1,12 +1,12 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
using ProjectCruiser.Exceptions; using ProjectPlane.Exceptions;
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Реализация абстрактной компании - каршеринг /// Реализация абстрактной компании - каршеринг
/// </summary> /// </summary>
public class CruiserDockingService : AbstractCompany public class PlaneDockingService : AbstractCompany
{ {
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -14,8 +14,8 @@ namespace ProjectCruiser.CollectionGenericObjects
/// <param name="picWidth"></param> /// <param name="picWidth"></param>
/// <param name="picHeight"></param> /// <param name="picHeight"></param>
/// <param name="collection"></param> /// <param name="collection"></param>
public CruiserDockingService(int picWidth, int picHeight, public PlaneDockingService(int picWidth, int picHeight,
ICollectionGenericObjects<DrawningCruiser> collection) : base(picWidth, picHeight, collection) ICollectionGenericObjects<DrawningPlane> collection) : base(picWidth, picHeight, collection)
{ {
} }
protected override void DrawBackgound(Graphics g) protected override void DrawBackgound(Graphics g)

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Интерфейс описания действий для набора хранимых объектов /// Интерфейс описания действий для набора хранимых объектов

View File

@ -1,6 +1,6 @@
using ProjectCruiser.Exceptions; using ProjectPlane.Exceptions;
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Параметризованный набор объектов /// Параметризованный набор объектов

View File

@ -1,6 +1,6 @@
using ProjectCruiser.Exceptions; using ProjectPlane.Exceptions;
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Параметризованный набор объектов /// Параметризованный набор объектов

View File

@ -1,14 +1,14 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
using ProjectCruiser.Exceptions; using ProjectPlane.Exceptions;
using System.Text; using System.Text;
namespace ProjectCruiser.CollectionGenericObjects namespace ProjectPlane.CollectionGenericObjects
{ {
// Класс-хранилище коллекций // Класс-хранилище коллекций
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public class StorageCollection<T> public class StorageCollection<T>
where T : DrawningCruiser where T : DrawningPlane
{ {
/// <summary> /// <summary>
/// Словарь (хранилище) с коллекциями /// Словарь (хранилище) с коллекциями
@ -180,7 +180,7 @@ namespace ProjectCruiser.CollectionGenericObjects
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set) foreach (string elem in set)
{ {
if (elem?.CreateDrawningCruiser() is T aircraft) if (elem?.CreateDrawningPlane() is T aircraft)
{ {
try try
{ {

View File

@ -1,10 +1,10 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
namespace ProjectCruiser; namespace ProjectPlane;
/// <summary> /// <summary>
/// Делегат передачи объекта класса-прорисвоки /// Делегат передачи объекта класса-прорисвоки
/// </summary> /// </summary>
/// <param name="cruiser"></param> /// <param name="plane"></param>
public delegate void CruiserDelegate(DrawningCruiser cruiser); public delegate void PlaneDelegate(DrawningPlane plane);

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.Drawnings; namespace ProjectPlane.Drawnings;
/// <summary> /// <summary>
/// Направление перемещения /// Направление перемещения
/// </summary> /// </summary>

View File

@ -1,15 +1,15 @@
using ProjectCruiser.Entities; using ProjectPlane.Entities;
namespace ProjectCruiser.Drawnings; namespace ProjectPlane.Drawnings;
/// <summary> /// <summary>
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// Класс, отвечающий за прорисовку и перемещение объекта-сущности
/// </summary> /// </summary>
public class DrawningCruiser public class DrawningPlane
{ {
/// <summary> /// <summary>
/// Класс-сущность /// Класс-сущность
/// </summary> /// </summary>
public EntityCruiser? EntityCruiser { get; protected set; } public EntityPlane? EntityPlane { get; protected set; }
/// <summary> /// <summary>
/// Ширина окна /// Ширина окна
/// </summary> /// </summary>
@ -19,22 +19,22 @@ public class DrawningCruiser
/// </summary> /// </summary>
private int? _pictureHeight; private int? _pictureHeight;
/// <summary> /// <summary>
/// Левая координата прорисовки крейсера /// Левая координата прорисовки самолета
/// </summary> /// </summary>
protected int? _startPosX; protected int? _startPosX;
/// <summary> /// <summary>
/// Верхняя кооридната прорисовки крейсера /// Верхняя кооридната прорисовки самолета
/// </summary> /// </summary>
protected int? _startPosY; protected int? _startPosY;
/// <summary> /// <summary>
/// Ширина прорисовки крейсера /// Ширина прорисовки самолета
/// </summary> /// </summary>
private readonly int _drawningCruiserWidth = 150; private readonly int _drawningPlaneWidth = 150;
/// <summary> /// <summary>
/// Высота прорисовки крейсера /// Высота прорисовки самолета
/// </summary> /// </summary>
private readonly int _drawningCruiserHeight = 50; private readonly int _drawningPlaneHeight = 50;
private readonly int _drawningEnginesWidth = 3; private readonly int _drawningEnginesWidth = 3;
/// <summary> /// <summary>
@ -48,16 +48,16 @@ public class DrawningCruiser
/// <summary> /// <summary>
/// Ширина объекта /// Ширина объекта
/// </summary> /// </summary>
public int GetWidth => _drawningCruiserWidth; public int GetWidth => _drawningPlaneWidth;
/// <summary> /// <summary>
/// Высота объекта /// Высота объекта
/// </summary> /// </summary>
public int GetHeight => _drawningCruiserHeight; public int GetHeight => _drawningPlaneHeight;
/// <summary> /// <summary>
/// Пустой онструктор /// Пустой онструктор
/// </summary> /// </summary>
public DrawningCruiser() public DrawningPlane()
{ {
_pictureWidth = null; _pictureWidth = null;
_pictureHeight = null; _pictureHeight = null;
@ -71,28 +71,28 @@ public class DrawningCruiser
/// <param name="speed">Скорость</param> /// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param> /// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param> /// <param name="bodyColor">Основной цвет</param>
public DrawningCruiser(int speed, double weight, Color bodyColor) : this() public DrawningPlane(int speed, double weight, Color bodyColor) : this()
{ {
EntityCruiser = new EntityCruiser(speed, weight, bodyColor); EntityPlane = new EntityPlane(speed, weight, bodyColor);
} }
/// <summary> /// <summary>
/// Конструктор для наследников /// Конструктор для наследников
/// </summary> /// </summary>
/// <param name="drawningCarWidth">Ширина прорисовки автомобиля</param> /// <param name="drawningCarWidth">Ширина прорисовки автомобиля</param>
/// <param name="drawningCarHeight">Высота прорисовки автомобиля</param> /// <param name="drawningCarHeight">Высота прорисовки автомобиля</param>
protected DrawningCruiser(int drawningCarWidth, int drawningCarHeight) : this() protected DrawningPlane(int drawningCarWidth, int drawningCarHeight) : this()
{ {
_drawningCruiserWidth = drawningCarWidth; _drawningPlaneWidth = drawningCarWidth;
_pictureHeight = drawningCarHeight; _pictureHeight = drawningCarHeight;
} }
/// <summary> /// <summary>
/// конструктор /// конструктор
/// </summary> /// </summary>
/// <param name="entityCruiser"></param> /// <param name="entityPlane"></param>
public DrawningCruiser(EntityCruiser entityCruiser) public DrawningPlane(EntityPlane entityPlane)
{ {
EntityCruiser = entityCruiser; EntityPlane = entityPlane;
} }
/// <summary> /// <summary>
@ -106,7 +106,7 @@ public class DrawningCruiser
// TODO проверка, что объект "влезает" в размеры поля // TODO проверка, что объект "влезает" в размеры поля
// если влезает, сохраняем границы и корректируем позицию объекта,если она была уже установлена // если влезает, сохраняем границы и корректируем позицию объекта,если она была уже установлена
if (_drawningCruiserHeight > height || _drawningCruiserWidth > width) if (_drawningPlaneHeight > height || _drawningPlaneWidth > width)
{ {
return false; return false;
@ -134,10 +134,10 @@ public class DrawningCruiser
return; return;
} }
if (x < 0 || x + _drawningCruiserWidth > _pictureWidth || y < 0 || y + _drawningCruiserHeight > _pictureHeight) if (x < 0 || x + _drawningPlaneWidth > _pictureWidth || y < 0 || y + _drawningPlaneHeight > _pictureHeight)
{ {
_startPosX = _pictureWidth - _drawningCruiserWidth; _startPosX = _pictureWidth - _drawningPlaneWidth;
_startPosY = _pictureHeight - _drawningCruiserHeight; _startPosY = _pictureHeight - _drawningPlaneHeight;
} }
else else
{ {
@ -153,7 +153,7 @@ public class DrawningCruiser
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns> /// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
public bool MoveTransport(DirectionType direction) public bool MoveTransport(DirectionType direction)
{ {
if (EntityCruiser == null || !_startPosX.HasValue || !_startPosY.HasValue) if (EntityPlane == null || !_startPosX.HasValue || !_startPosY.HasValue)
{ {
return false; return false;
} }
@ -161,31 +161,31 @@ public class DrawningCruiser
{ {
//влево //влево
case DirectionType.Left: case DirectionType.Left:
if (_startPosX.Value - EntityCruiser.Step - _drawningEnginesWidth > 0) if (_startPosX.Value - EntityPlane.Step - _drawningEnginesWidth > 0)
{ {
_startPosX -= (int)EntityCruiser.Step; _startPosX -= (int)EntityPlane.Step;
} }
return true; return true;
//вверх //вверх
case DirectionType.Up: case DirectionType.Up:
if (_startPosY.Value - EntityCruiser.Step > 0) if (_startPosY.Value - EntityPlane.Step > 0)
{ {
_startPosY -= (int)EntityCruiser.Step; _startPosY -= (int)EntityPlane.Step;
} }
return true; return true;
// вправо // вправо
case DirectionType.Right: case DirectionType.Right:
//TODO прописать логику сдвига в право //TODO прописать логику сдвига в право
if (_startPosX.Value + EntityCruiser.Step + _drawningCruiserWidth < _pictureWidth) if (_startPosX.Value + EntityPlane.Step + _drawningPlaneWidth < _pictureWidth)
{ {
_startPosX += (int)EntityCruiser.Step; _startPosX += (int)EntityPlane.Step;
} }
return true; return true;
//вниз //вниз
case DirectionType.Down: case DirectionType.Down:
if (_startPosY.Value + EntityCruiser.Step + _drawningCruiserHeight < _pictureHeight) if (_startPosY.Value + EntityPlane.Step + _drawningPlaneHeight < _pictureHeight)
{ {
_startPosY += (int)EntityCruiser.Step; _startPosY += (int)EntityPlane.Step;
} }
return true; return true;
default: default:
@ -199,15 +199,15 @@ public class DrawningCruiser
/// <param name="g"></param> /// <param name="g"></param>
public virtual void DrawTransport(Graphics g) public virtual void DrawTransport(Graphics g)
{ {
if (EntityCruiser == null || !_startPosX.HasValue || if (EntityPlane == null || !_startPosX.HasValue ||
!_startPosY.HasValue) !_startPosY.HasValue)
{ {
return; return;
} }
Pen pen = new(EntityCruiser.BodyColor, 2); Pen pen = new(EntityPlane.BodyColor, 2);
Brush additionalBrush = new SolidBrush(Color.Black); Brush additionalBrush = new SolidBrush(Color.Black);
//границы круисера //границы самолета
g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value + 105, _startPosY.Value); g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value + 105, _startPosY.Value);
g.DrawLine(pen, _startPosX.Value + 105, _startPosY.Value, _startPosX.Value + 147, _startPosY.Value + 24); g.DrawLine(pen, _startPosX.Value + 105, _startPosY.Value, _startPosX.Value + 147, _startPosY.Value + 24);
@ -216,7 +216,7 @@ public class DrawningCruiser
g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value, _startPosY.Value + 49); g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value, _startPosY.Value + 49);
//внутренности круисера //внутренности самолета
g.DrawEllipse(pen, _startPosX.Value + 94, _startPosY.Value + 14, 19, 19); g.DrawEllipse(pen, _startPosX.Value + 94, _startPosY.Value + 14, 19, 19);
g.DrawRectangle(pen, _startPosX.Value + 63, _startPosY.Value + 11, 21, 28); g.DrawRectangle(pen, _startPosX.Value + 63, _startPosY.Value + 11, 21, 28);

View File

@ -1,9 +1,9 @@
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using ProjectCruiser.Entities; using ProjectPlane.Entities;
namespace ProjectCruiser.Drawnings namespace ProjectPlane.Drawnings
{ {
public class DrawningMilitaryCruiser : DrawningCruiser public class DrawningSeaPlane : DrawningPlane
{ {
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -12,48 +12,48 @@ namespace ProjectCruiser.Drawnings
/// <param name="weight">Вес</param> /// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param> /// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param> /// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="helicopterArea">Признак наличия вертолетной площадки</param> /// <param name="line">Признак наличия линии</param>
/// <param name="boat">Признак наличия шлюпок</param> /// <param name="boat">Признак наличия шлюпки</param>
/// <param name="weapon">Признак наличия пушки</param> /// <param name="floats">Признак наличия поплавков</param>
public DrawningMilitaryCruiser(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool boat, bool weapon) public DrawningSeaPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool line, bool boat, bool floats)
: base(150, 50) : base(150, 50)
{ {
EntityCruiser = new EntityMilitaryCruiser(speed, weight, bodyColor, additionalColor, helicopterArea, boat, weapon); EntityPlane = new EntitySeaPlane(speed, weight, bodyColor, additionalColor, line, boat, floats);
} }
public DrawningMilitaryCruiser(EntityCruiser entityCruiser) public DrawningSeaPlane(EntityPlane entityPlane)
{ {
if (entityCruiser != null) if (entityPlane != null)
{ {
EntityCruiser = entityCruiser; EntityPlane = entityPlane;
} }
} }
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
{ {
if (EntityCruiser == null || EntityCruiser is not EntityMilitaryCruiser entityMilitaryCruiser || !_startPosX.HasValue || if (EntityPlane == null || EntityPlane is not EntitySeaPlane entitySeaPlane || !_startPosX.HasValue ||
!_startPosY.HasValue) !_startPosY.HasValue)
{ {
return; return;
} }
Pen pen = new(entityMilitaryCruiser.BodyColor, 2); Pen pen = new(entitySeaPlane.BodyColor, 2);
Brush additionalBrush = new SolidBrush(Color.Black); Brush additionalBrush = new SolidBrush(Color.Black);
Brush weaponBrush = new SolidBrush(Color.Black); Brush floatsBrush = new SolidBrush(Color.Black);
Brush weaponBrush2 = new SolidBrush(entityMilitaryCruiser.AdditionalColor); Brush floatsBrush2 = new SolidBrush(entitySeaPlane.AdditionalColor);
Brush helicopterAreaBrush = new HatchBrush(HatchStyle.ZigZag, entityMilitaryCruiser.AdditionalColor, Color.FromArgb(163, 163, 163)); Brush lineBrush = new HatchBrush(HatchStyle.ZigZag, entitySeaPlane.AdditionalColor, Color.FromArgb(163, 163, 163));
Brush boatBrush = new SolidBrush(entityMilitaryCruiser.AdditionalColor); Brush boatBrush = new SolidBrush(entitySeaPlane.AdditionalColor);
base.DrawTransport(g); base.DrawTransport(g);
if (entityMilitaryCruiser.HelicopterArea) if (entitySeaPlane.Line)
{ {
g.FillEllipse(helicopterAreaBrush, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30); g.FillEllipse(lineBrush, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30); g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
} }
if (entityMilitaryCruiser.Boat) if (entitySeaPlane.Boat)
{ {
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7); g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7); g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
@ -62,12 +62,12 @@ namespace ProjectCruiser.Drawnings
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7); g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7);
} }
if (entityMilitaryCruiser.Weapon) if (entitySeaPlane.Floats)
{ {
g.DrawEllipse(pen, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10); g.DrawEllipse(pen, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
g.FillEllipse(weaponBrush2, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10); g.FillEllipse(floatsBrush2, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
g.FillRectangle(weaponBrush, _startPosX.Value + 107, _startPosY.Value + 40, 15, 5); g.FillRectangle(floatsBrush, _startPosX.Value + 107, _startPosY.Value + 40, 15, 5);
} }
} }

View File

@ -1,8 +1,8 @@
using ProjectCruiser.Entities; using ProjectPlane.Entities;
namespace ProjectCruiser.Drawnings namespace ProjectPlane.Drawnings
{ {
public static class ExtentionDrawningCruiser public static class ExtentionDrawningPlane
{ {
/// <summary> /// <summary>
/// Разделитель для записи информации по объекту в файл /// Разделитель для записи информации по объекту в файл
@ -14,19 +14,19 @@ namespace ProjectCruiser.Drawnings
/// </summary> /// </summary>
/// <param name="info">Строка с данными для создания объекта</param> /// <param name="info">Строка с данными для создания объекта</param>
/// <returns>Объект</returns> /// <returns>Объект</returns>
public static DrawningCruiser? CreateDrawningCruiser(this string info) public static DrawningPlane? CreateDrawningPlane(this string info)
{ {
string[] strs = info.Split(_separatorForObject); string[] strs = info.Split(_separatorForObject);
EntityCruiser? cruiser = EntityMilitaryCruiser.CreateEntityMilitaryCruiser(strs); EntityPlane? plane = EntitySeaPlane.CreateEntitySeaPlane(strs);
if (cruiser != null) if (plane != null)
{ {
return new DrawningMilitaryCruiser(cruiser); return new DrawningSeaPlane(plane);
} }
cruiser = EntityCruiser.CreateEntityCruiser(strs); plane = EntityPlane.CreateEntityPlane(strs);
if (cruiser != null) if (plane != null)
{ {
return new DrawningCruiser(cruiser); return new DrawningPlane(plane);
} }
return null; return null;
} }
@ -36,9 +36,9 @@ namespace ProjectCruiser.Drawnings
/// </summary> /// </summary>
/// <param name="drawningCrusier">Сохраняемый объект</param> /// <param name="drawningCrusier">Сохраняемый объект</param>
/// <returns>Строка с данными по объекту</returns> /// <returns>Строка с данными по объекту</returns>
public static string GetDataForSave(this DrawningCruiser drawningCrusier) public static string GetDataForSave(this DrawningPlane drawningCrusier)
{ {
string[]? array = drawningCrusier?.EntityCruiser?.GetStringRepresentation(); string[]? array = drawningCrusier?.EntityPlane?.GetStringRepresentation();
if (array == null) if (array == null)
{ {
return string.Empty; return string.Empty;

View File

@ -1,9 +1,9 @@
namespace ProjectCruiser.Entities; namespace ProjectPlane.Entities;
/// <summary> /// <summary>
/// Класс-сущность "крейсер" /// Класс-сущность "самолет"
/// </summary> /// </summary>
public class EntityCruiser public class EntityPlane
{ {
//свойства //свойства
/// <summary> /// <summary>
@ -31,12 +31,12 @@ public class EntityCruiser
public double Step => Speed * 100 / Weight; public double Step => Speed * 100 / Weight;
/// <summary> /// <summary>
/// Инициализация полей объекта-класса крейсера /// Инициализация полей объекта-класса самолета
/// </summary> /// </summary>
/// <param name="speed">скорость</param> /// <param name="speed">скорость</param>
/// <param name="weight">вес</param> /// <param name="weight">вес</param>
/// <param name="bodyColor">основной цвет</param> /// <param name="bodyColor">основной цвет</param>
public EntityCruiser(int speed, double weight, Color bodyColor) public EntityPlane(int speed, double weight, Color bodyColor)
{ {
Speed = speed; Speed = speed;
Weight = weight; Weight = weight;
@ -49,7 +49,7 @@ public class EntityCruiser
/// <returns></returns> /// <returns></returns>
public virtual string[] GetStringRepresentation() public virtual string[] GetStringRepresentation()
{ {
return new[] { nameof(EntityCruiser), Speed.ToString(), Weight.ToString(), BodyColor.Name }; return new[] { nameof(EntityPlane), Speed.ToString(), Weight.ToString(), BodyColor.Name };
} }
/// <summary> /// <summary>
@ -57,13 +57,13 @@ public class EntityCruiser
/// </summary> /// </summary>
/// <param name="strs"></param> /// <param name="strs"></param>
/// <returns></returns> /// <returns></returns>
public static EntityCruiser? CreateEntityCruiser(string[] strs) public static EntityPlane? CreateEntityPlane(string[] strs)
{ {
if (strs.Length != 4 || strs[0] != nameof(EntityCruiser)) if (strs.Length != 4 || strs[0] != nameof(EntityPlane))
{ {
return null; return null;
} }
return new EntityCruiser(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3])); return new EntityPlane(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
} }
} }

View File

@ -1,21 +1,21 @@
namespace ProjectCruiser.Entities namespace ProjectPlane.Entities
{ {
internal class EntityMilitaryCruiser : EntityCruiser internal class EntitySeaPlane : EntityPlane
{ {
/// <summary> /// <summary>
/// Признак (опция) наличие вертолетной площадки /// Признак (опция) наличие линии
/// </summary> /// </summary>
public bool HelicopterArea { get; private set; } public bool Line { get; private set; }
/// <summary> /// <summary>
/// Признак (опция) наличие шлюпок /// Признак (опция) наличие шлюпки
/// </summary> /// </summary>
public bool Boat { get; private set; } public bool Boat { get; private set; }
/// <summary> /// <summary>
/// Признак (опция) наличие пушки /// Признак (опция) наличие поплавков
/// </summary> /// </summary>
public bool Weapon { get; private set; } public bool Floats { get; private set; }
/// <summary> /// <summary>
/// Дополнительный цвет (для опциональных элементов) /// Дополнительный цвет (для опциональных элементов)
@ -26,12 +26,12 @@
AdditionalColor = color; AdditionalColor = color;
} }
public EntityMilitaryCruiser(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool boat, bool weapon) : base(speed, weight, bodyColor) public EntitySeaPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool line, bool boat, bool floats) : base(speed, weight, bodyColor)
{ {
AdditionalColor = additionalColor; AdditionalColor = additionalColor;
HelicopterArea = helicopterArea; Line = line;
Boat = boat; Boat = boat;
Weapon = weapon; Floats = floats;
} }
/// <summary> /// <summary>
@ -40,8 +40,8 @@
/// <returns></returns> /// <returns></returns>
public override string[] GetStringRepresentation() public override string[] GetStringRepresentation()
{ {
return new[] { nameof(EntityCruiser), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, return new[] { nameof(EntityPlane), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name,
HelicopterArea.ToString(), Boat.ToString(), Weapon.ToString() }; Line.ToString(), Boat.ToString(), Floats.ToString() };
} }
/// <summary> /// <summary>
@ -49,13 +49,13 @@
/// </summary> /// </summary>
/// <param name="strs"></param> /// <param name="strs"></param>
/// <returns></returns> /// <returns></returns>
public static EntityCruiser? CreateEntityMilitaryCruiser(string[] strs) public static EntityPlane? CreateEntitySeaPlane(string[] strs)
{ {
if (strs.Length != 8 || strs[0] != nameof(EntityCruiser)) if (strs.Length != 8 || strs[0] != nameof(EntityPlane))
{ {
return null; return null;
} }
return new EntityMilitaryCruiser(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), return new EntitySeaPlane(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]),
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7])); Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7]));
} }
} }

View File

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ProjectCruiser.Exceptions; namespace ProjectPlane.Exceptions;
/// <summary> /// <summary>
/// Класс, описывающий ошибку переполнения коллекции /// Класс, описывающий ошибку переполнения коллекции

View File

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ProjectCruiser.Exceptions; namespace ProjectPlane.Exceptions;
/// <summary> /// <summary>
/// Класс, описывающий ошибку, что по указанной позиции нет элемента /// Класс, описывающий ошибку, что по указанной позиции нет элемента

View File

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ProjectCruiser.Exceptions; namespace ProjectPlane.Exceptions;
/// <summary> /// <summary>
/// Класс, описывающий ошибку выхода за границы коллекции /// Класс, описывающий ошибку выхода за границы коллекции

View File

@ -1,6 +1,6 @@
namespace ProjectCruiser namespace ProjectPlane
{ {
partial class FormCruiser partial class FormPlane
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -28,26 +28,26 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCruiser)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPlane));
pictureBoxCruiser = new PictureBox(); pictureBoxPlane = new PictureBox();
buttonUp = new Button(); buttonUp = new Button();
buttonDown = new Button(); buttonDown = new Button();
buttonRight = new Button(); buttonRight = new Button();
buttonLeft = new Button(); buttonLeft = new Button();
comboBoxStrategy = new ComboBox(); comboBoxStrategy = new ComboBox();
buttonStrategyStep = new Button(); buttonStrategyStep = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxCruiser).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxPlane).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// pictureBoxCruiser // pictureBoxPlane
// //
pictureBoxCruiser.Dock = DockStyle.Fill; pictureBoxPlane.Dock = DockStyle.Fill;
pictureBoxCruiser.Location = new Point(0, 0); pictureBoxPlane.Location = new Point(0, 0);
pictureBoxCruiser.Name = "pictureBoxCruiser"; pictureBoxPlane.Name = "pictureBoxPlane";
pictureBoxCruiser.Size = new Size(800, 450); pictureBoxPlane.Size = new Size(800, 450);
pictureBoxCruiser.SizeMode = PictureBoxSizeMode.AutoSize; pictureBoxPlane.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxCruiser.TabIndex = 0; pictureBoxPlane.TabIndex = 0;
pictureBoxCruiser.TabStop = false; pictureBoxPlane.TabStop = false;
// //
// buttonUp // buttonUp
// //
@ -118,7 +118,7 @@
buttonStrategyStep.UseVisualStyleBackColor = true; buttonStrategyStep.UseVisualStyleBackColor = true;
buttonStrategyStep.Click += ButtonStrategyStep_Click; buttonStrategyStep.Click += ButtonStrategyStep_Click;
// //
// FormCruiser // FormPlane
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
@ -129,18 +129,18 @@
Controls.Add(buttonRight); Controls.Add(buttonRight);
Controls.Add(buttonDown); Controls.Add(buttonDown);
Controls.Add(buttonUp); Controls.Add(buttonUp);
Controls.Add(pictureBoxCruiser); Controls.Add(pictureBoxPlane);
Name = "FormCruiser"; Name = "FormPlane";
Text = "FormCruiser"; Text = "FormPlane";
Click += ButtonMove_Click; Click += ButtonMove_Click;
((System.ComponentModel.ISupportInitialize)pictureBoxCruiser).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxPlane).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
#endregion #endregion
private PictureBox pictureBoxCruiser; private PictureBox pictureBoxPlane;
private Button buttonUp; private Button buttonUp;
private Button buttonDown; private Button buttonDown;
private Button buttonRight; private Button buttonRight;

View File

@ -1,14 +1,14 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
using ProjectCruiser.MovementStrategy; using ProjectPlane.MovementStrategy;
namespace ProjectCruiser namespace ProjectPlane
{ {
public partial class FormCruiser : Form public partial class FormPlane : Form
{ {
/// <summary> /// <summary>
/// Поле-объект для прорисовки объекта /// Поле-объект для прорисовки объекта
/// </summary> /// </summary>
private DrawningCruiser? _drawningCruiser; private DrawningPlane? _drawningPlane;
/// <summary> /// <summary>
/// Стратегия перемещения /// Стратегия перемещения
@ -18,13 +18,13 @@ namespace ProjectCruiser
/// <summary> /// <summary>
/// Получение объекта /// Получение объекта
/// </summary> /// </summary>
public DrawningCruiser SetCruiser public DrawningPlane SetPlane
{ {
set set
{ {
_drawningCruiser = value; _drawningPlane = value;
_drawningCruiser.SetPictureSize(pictureBoxCruiser.Width, _drawningPlane.SetPictureSize(pictureBoxPlane.Width,
pictureBoxCruiser.Height); pictureBoxPlane.Height);
comboBoxStrategy.Enabled = true; comboBoxStrategy.Enabled = true;
_strategy = null; _strategy = null;
Draw(); Draw();
@ -34,26 +34,26 @@ namespace ProjectCruiser
/// <summary> /// <summary>
/// Конструктор формы /// Конструктор формы
/// </summary> /// </summary>
public FormCruiser() public FormPlane()
{ {
InitializeComponent(); InitializeComponent();
_strategy = null; _strategy = null;
} }
/// <summary> /// <summary>
/// Метод прорисовки круисера /// Метод прорисовки самолета
/// </summary> /// </summary>
private void Draw() private void Draw()
{ {
if (_drawningCruiser == null) if (_drawningPlane == null)
{ {
return; return;
} }
Bitmap bmp = new(pictureBoxCruiser.Width, Bitmap bmp = new(pictureBoxPlane.Width,
pictureBoxCruiser.Height); pictureBoxPlane.Height);
Graphics gr = Graphics.FromImage(bmp); Graphics gr = Graphics.FromImage(bmp);
_drawningCruiser.DrawTransport(gr); _drawningPlane.DrawTransport(gr);
pictureBoxCruiser.Image = bmp; pictureBoxPlane.Image = bmp;
} }
/// <summary> /// <summary>
@ -63,7 +63,7 @@ namespace ProjectCruiser
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e) private void ButtonMove_Click(object sender, EventArgs e)
{ {
if (_drawningCruiser == null) if (_drawningPlane == null)
{ {
return; return;
} }
@ -72,17 +72,17 @@ namespace ProjectCruiser
switch (name) switch (name)
{ {
case "buttonUp": case "buttonUp":
result = _drawningCruiser.MoveTransport(DirectionType.Up); result = _drawningPlane.MoveTransport(DirectionType.Up);
break; break;
case "buttonDown": case "buttonDown":
result = _drawningCruiser.MoveTransport(DirectionType.Down); result = _drawningPlane.MoveTransport(DirectionType.Down);
break; break;
case "buttonLeft": case "buttonLeft":
result = _drawningCruiser.MoveTransport(DirectionType.Left); result = _drawningPlane.MoveTransport(DirectionType.Left);
break; break;
case "buttonRight": case "buttonRight":
result = result =
_drawningCruiser.MoveTransport(DirectionType.Right); _drawningPlane.MoveTransport(DirectionType.Right);
break; break;
} }
if (result) if (result)
@ -98,7 +98,7 @@ namespace ProjectCruiser
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonStrategyStep_Click(object sender, EventArgs e) private void ButtonStrategyStep_Click(object sender, EventArgs e)
{ {
if (_drawningCruiser == null) if (_drawningPlane == null)
{ {
return; return;
} }
@ -116,7 +116,7 @@ namespace ProjectCruiser
{ {
return; return;
} }
_strategy.SetData(new MoveableCruiser(_drawningCruiser), pictureBoxCruiser.Width, pictureBoxCruiser.Height); _strategy.SetData(new MoveablePlane(_drawningPlane), pictureBoxPlane.Width, pictureBoxPlane.Height);
} }
if (_strategy == null) if (_strategy == null)

View File

@ -1,6 +1,6 @@
namespace ProjectCruiser namespace ProjectPlane
{ {
partial class FormCruiserConfing partial class FormPlaneConfing
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -38,9 +38,9 @@
panelBlue = new Panel(); panelBlue = new Panel();
panelGreen = new Panel(); panelGreen = new Panel();
panelRed = new Panel(); panelRed = new Panel();
checkBoxWeapon = new CheckBox(); checkBoxFloats = new CheckBox();
checkBoxBoat = new CheckBox(); checkBoxBoat = new CheckBox();
checkBoxHelicopterArea = new CheckBox(); checkBoxLine = new CheckBox();
numericUpDownWeight = new NumericUpDown(); numericUpDownWeight = new NumericUpDown();
labelWeight = new Label(); labelWeight = new Label();
numericUpDownSpeed = new NumericUpDown(); numericUpDownSpeed = new NumericUpDown();
@ -64,9 +64,9 @@
// groupBoxConfing // groupBoxConfing
// //
groupBoxConfing.Controls.Add(groupBoxColors); groupBoxConfing.Controls.Add(groupBoxColors);
groupBoxConfing.Controls.Add(checkBoxWeapon); groupBoxConfing.Controls.Add(checkBoxFloats);
groupBoxConfing.Controls.Add(checkBoxBoat); groupBoxConfing.Controls.Add(checkBoxBoat);
groupBoxConfing.Controls.Add(checkBoxHelicopterArea); groupBoxConfing.Controls.Add(checkBoxLine);
groupBoxConfing.Controls.Add(numericUpDownWeight); groupBoxConfing.Controls.Add(numericUpDownWeight);
groupBoxConfing.Controls.Add(labelWeight); groupBoxConfing.Controls.Add(labelWeight);
groupBoxConfing.Controls.Add(numericUpDownSpeed); groupBoxConfing.Controls.Add(numericUpDownSpeed);
@ -162,15 +162,15 @@
panelRed.Size = new Size(48, 47); panelRed.Size = new Size(48, 47);
panelRed.TabIndex = 0; panelRed.TabIndex = 0;
// //
// checkBoxWeapon // checkBoxFloats
// //
checkBoxWeapon.AutoSize = true; checkBoxFloats.AutoSize = true;
checkBoxWeapon.Location = new Point(6, 217); checkBoxFloats.Location = new Point(6, 217);
checkBoxWeapon.Name = "checkBoxWeapon"; checkBoxFloats.Name = "checkBoxFloats";
checkBoxWeapon.Size = new Size(202, 24); checkBoxFloats.Size = new Size(202, 24);
checkBoxWeapon.TabIndex = 8; checkBoxFloats.TabIndex = 8;
checkBoxWeapon.Text = "Признак наличие пушки"; checkBoxFloats.Text = "Признак наличие пушки";
checkBoxWeapon.UseVisualStyleBackColor = true; checkBoxFloats.UseVisualStyleBackColor = true;
// //
// checkBoxBoat // checkBoxBoat
// //
@ -182,15 +182,15 @@
checkBoxBoat.Text = "Признак наличие шлюпок"; checkBoxBoat.Text = "Признак наличие шлюпок";
checkBoxBoat.UseVisualStyleBackColor = true; checkBoxBoat.UseVisualStyleBackColor = true;
// //
// checkBoxHelicopterArea // checkBoxLine
// //
checkBoxHelicopterArea.AutoSize = true; checkBoxLine.AutoSize = true;
checkBoxHelicopterArea.Location = new Point(6, 123); checkBoxLine.Location = new Point(6, 123);
checkBoxHelicopterArea.Name = "checkBoxHelicopterArea"; checkBoxLine.Name = "checkBoxLine";
checkBoxHelicopterArea.Size = new Size(321, 24); checkBoxLine.Size = new Size(321, 24);
checkBoxHelicopterArea.TabIndex = 6; checkBoxLine.TabIndex = 6;
checkBoxHelicopterArea.Text = "Признак наличие вертолетной площадки"; checkBoxLine.Text = "Признак наличие вертолетной площадки";
checkBoxHelicopterArea.UseVisualStyleBackColor = true; checkBoxLine.UseVisualStyleBackColor = true;
// //
// numericUpDownWeight // numericUpDownWeight
// //
@ -318,7 +318,7 @@
labelBodyColor.DragDrop += labelBodyColor_DragDrop; labelBodyColor.DragDrop += labelBodyColor_DragDrop;
labelBodyColor.DragEnter += labelBodyColor_DragEnter; labelBodyColor.DragEnter += labelBodyColor_DragEnter;
// //
// FormCruiserConfing // FormPlaneConfing
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
@ -327,7 +327,7 @@
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonAdd); Controls.Add(buttonAdd);
Controls.Add(groupBoxConfing); Controls.Add(groupBoxConfing);
Name = "FormCruiserConfing"; Name = "FormPlaneConfing";
Text = "Создание объекта"; Text = "Создание объекта";
groupBoxConfing.ResumeLayout(false); groupBoxConfing.ResumeLayout(false);
groupBoxConfing.PerformLayout(); groupBoxConfing.PerformLayout();
@ -348,9 +348,9 @@
private NumericUpDown numericUpDownSpeed; private NumericUpDown numericUpDownSpeed;
private Label labelSpeed; private Label labelSpeed;
private NumericUpDown numericUpDownWeight; private NumericUpDown numericUpDownWeight;
private CheckBox checkBoxHelicopterArea; private CheckBox checkBoxLine;
private CheckBox checkBoxBoat; private CheckBox checkBoxBoat;
private CheckBox checkBoxWeapon; private CheckBox checkBoxFloats;
private GroupBox groupBoxColors; private GroupBox groupBoxColors;
private Panel panelPurple; private Panel panelPurple;
private Panel panelBlack; private Panel panelBlack;

View File

@ -1,36 +1,36 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
using ProjectCruiser.Entities; using ProjectPlane.Entities;
namespace ProjectCruiser namespace ProjectPlane
{ {
/// <summary> /// <summary>
/// Форма конфигурации объекта /// Форма конфигурации объекта
/// </summary> /// </summary>
public partial class FormCruiserConfing : Form public partial class FormPlaneConfing : Form
{ {
/// <summary> /// <summary>
/// Объект - прорисовка крейсера /// Объект - прорисовка самолета
/// </summary> /// </summary>
private DrawningCruiser _cruiser; private DrawningPlane _plane;
/// <summary> /// <summary>
/// Событие для передачи объекта /// Событие для передачи объекта
/// </summary> /// </summary>
private event Action<DrawningCruiser>? CruiserDelegate; private event Action<DrawningPlane>? PlaneDelegate;
/// <summary> /// <summary>
/// Привязка внешнего метода к событию /// Привязка внешнего метода к событию
/// </summary> /// </summary>
/// <param name="carDelegate"></param> /// <param name="carDelegate"></param>
public void AddEvent(Action<DrawningCruiser> cruiserDelegate) public void AddEvent(Action<DrawningPlane> planeDelegate)
{ {
CruiserDelegate += cruiserDelegate; PlaneDelegate += planeDelegate;
} }
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
public FormCruiserConfing() public FormPlaneConfing()
{ {
InitializeComponent(); InitializeComponent();
@ -53,9 +53,9 @@ namespace ProjectCruiser
{ {
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp); Graphics gr = Graphics.FromImage(bmp);
_cruiser?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height); _plane?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
_cruiser?.SetPosition(15, 15); _plane?.SetPosition(15, 15);
_cruiser?.DrawTransport(gr); _plane?.DrawTransport(gr);
pictureBoxObject.Image = bmp; pictureBoxObject.Image = bmp;
} }
@ -90,12 +90,12 @@ namespace ProjectCruiser
switch (e.Data?.GetData(DataFormats.Text)?.ToString()) switch (e.Data?.GetData(DataFormats.Text)?.ToString())
{ {
case "labelSimpleObject": case "labelSimpleObject":
_cruiser = new DrawningCruiser((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White); _plane = new DrawningPlane((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
break; break;
case "labelModifiedObject": case "labelModifiedObject":
_cruiser = new _plane = new
DrawningMilitaryCruiser((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, DrawningSeaPlane((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
Color.Black, checkBoxHelicopterArea.Checked, checkBoxBoat.Checked, checkBoxWeapon.Checked); Color.Black, checkBoxLine.Checked, checkBoxBoat.Checked, checkBoxFloats.Checked);
break; break;
} }
DrawObject(); DrawObject();
@ -128,16 +128,16 @@ namespace ProjectCruiser
private void labelBodyColor_DragDrop(object sender, DragEventArgs e) private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
{ {
if (_cruiser != null) if (_plane != null)
{ {
_cruiser.EntityCruiser.setBodyColor((Color)e.Data.GetData(typeof(Color))); _plane.EntityPlane.setBodyColor((Color)e.Data.GetData(typeof(Color)));
DrawObject(); DrawObject();
} }
} }
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e) private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
{ {
if (_cruiser is DrawningCruiser) if (_plane is DrawningPlane)
{ {
if (e.Data.GetDataPresent(typeof(Color))) if (e.Data.GetDataPresent(typeof(Color)))
{ {
@ -152,9 +152,9 @@ namespace ProjectCruiser
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{ {
if (_cruiser.EntityCruiser is EntityMilitaryCruiser militaryCruiser) if (_plane.EntityPlane is EntitySeaPlane seaPlane)
{ {
militaryCruiser.setAdditionalColor((Color)e.Data.GetData(typeof(Color))); seaPlane.setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
} }
DrawObject(); DrawObject();
} }
@ -166,9 +166,9 @@ namespace ProjectCruiser
/// <param name="e"></param> /// <param name="e"></param>
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
if (_cruiser != null) if (_plane != null)
{ {
CruiserDelegate?.Invoke(_cruiser); PlaneDelegate?.Invoke(_plane);
Close(); Close();
} }
} }

View File

@ -1,6 +1,6 @@
namespace ProjectCruiser namespace ProjectPlane
{ {
partial class FormCruisersCollection partial class FormPlanesCollection
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -40,12 +40,12 @@
labelCollectionName = new Label(); labelCollectionName = new Label();
comboBoxSelectorCompany = new ComboBox(); comboBoxSelectorCompany = new ComboBox();
panelCompanyTools = new Panel(); panelCompanyTools = new Panel();
ButtonAddCruiser = new Button(); ButtonAddPlane = new Button();
buttonRefresh = new Button(); buttonRefresh = new Button();
ButtonRemoveCruiser = new Button(); ButtonRemovePlane = new Button();
maskedTextBoxPosision = new MaskedTextBox(); maskedTextBoxPosision = new MaskedTextBox();
buttonGetToTest = new Button(); buttonGetToTest = new Button();
pictureBoxCruiser = new PictureBox(); pictureBoxPlane = new PictureBox();
menuStrip = new MenuStrip(); menuStrip = new MenuStrip();
файлToolStripMenuItem = new ToolStripMenuItem(); файлToolStripMenuItem = new ToolStripMenuItem();
saveToolStripMenuItem = new ToolStripMenuItem(); saveToolStripMenuItem = new ToolStripMenuItem();
@ -55,7 +55,7 @@
groupBoxTools.SuspendLayout(); groupBoxTools.SuspendLayout();
panelStorage.SuspendLayout(); panelStorage.SuspendLayout();
panelCompanyTools.SuspendLayout(); panelCompanyTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCruiser).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxPlane).BeginInit();
menuStrip.SuspendLayout(); menuStrip.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
@ -178,9 +178,9 @@
// //
// panelCompanyTools // panelCompanyTools
// //
panelCompanyTools.Controls.Add(ButtonAddCruiser); panelCompanyTools.Controls.Add(ButtonAddPlane);
panelCompanyTools.Controls.Add(buttonRefresh); panelCompanyTools.Controls.Add(buttonRefresh);
panelCompanyTools.Controls.Add(ButtonRemoveCruiser); panelCompanyTools.Controls.Add(ButtonRemovePlane);
panelCompanyTools.Controls.Add(maskedTextBoxPosision); panelCompanyTools.Controls.Add(maskedTextBoxPosision);
panelCompanyTools.Controls.Add(buttonGetToTest); panelCompanyTools.Controls.Add(buttonGetToTest);
panelCompanyTools.Enabled = false; panelCompanyTools.Enabled = false;
@ -189,17 +189,17 @@
panelCompanyTools.Size = new Size(216, 274); panelCompanyTools.Size = new Size(216, 274);
panelCompanyTools.TabIndex = 8; panelCompanyTools.TabIndex = 8;
// //
// ButtonAddCruiser // ButtonAddPlane
// //
ButtonAddCruiser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; ButtonAddPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddCruiser.BackgroundImageLayout = ImageLayout.Center; ButtonAddPlane.BackgroundImageLayout = ImageLayout.Center;
ButtonAddCruiser.Location = new Point(18, 3); ButtonAddPlane.Location = new Point(18, 3);
ButtonAddCruiser.Name = "ButtonAddCruiser"; ButtonAddPlane.Name = "ButtonAddPlane";
ButtonAddCruiser.Size = new Size(186, 40); ButtonAddPlane.Size = new Size(186, 40);
ButtonAddCruiser.TabIndex = 1; ButtonAddPlane.TabIndex = 1;
ButtonAddCruiser.Text = "добваление крейсера"; ButtonAddPlane.Text = "добваление самолета";
ButtonAddCruiser.UseVisualStyleBackColor = true; ButtonAddPlane.UseVisualStyleBackColor = true;
ButtonAddCruiser.Click += ButtonAddCruiser_Click; ButtonAddPlane.Click += ButtonAddPlane_Click;
// //
// buttonRefresh // buttonRefresh
// //
@ -212,16 +212,16 @@
buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click; buttonRefresh.Click += ButtonRefresh_Click;
// //
// ButtonRemoveCruiser // ButtonRemovePlane
// //
ButtonRemoveCruiser.Anchor = AnchorStyles.Right; ButtonRemovePlane.Anchor = AnchorStyles.Right;
ButtonRemoveCruiser.Location = new Point(18, 138); ButtonRemovePlane.Location = new Point(18, 138);
ButtonRemoveCruiser.Name = "ButtonRemoveCruiser"; ButtonRemovePlane.Name = "ButtonRemovePlane";
ButtonRemoveCruiser.Size = new Size(186, 40); ButtonRemovePlane.Size = new Size(186, 40);
ButtonRemoveCruiser.TabIndex = 3; ButtonRemovePlane.TabIndex = 3;
ButtonRemoveCruiser.Text = "удалить крейсер"; ButtonRemovePlane.Text = "удалить самолет";
ButtonRemoveCruiser.UseVisualStyleBackColor = true; ButtonRemovePlane.UseVisualStyleBackColor = true;
ButtonRemoveCruiser.Click += ButtonRemoveCruiser_Click; ButtonRemovePlane.Click += ButtonRemovePlane_Click;
// //
// maskedTextBoxPosision // maskedTextBoxPosision
// //
@ -243,14 +243,14 @@
buttonGetToTest.UseVisualStyleBackColor = true; buttonGetToTest.UseVisualStyleBackColor = true;
buttonGetToTest.Click += ButtonGetToTest_Click; buttonGetToTest.Click += ButtonGetToTest_Click;
// //
// pictureBoxCruiser // pictureBoxPlane
// //
pictureBoxCruiser.Dock = DockStyle.Fill; pictureBoxPlane.Dock = DockStyle.Fill;
pictureBoxCruiser.Location = new Point(0, 28); pictureBoxPlane.Location = new Point(0, 28);
pictureBoxCruiser.Name = "pictureBoxCruiser"; pictureBoxPlane.Name = "pictureBoxPlane";
pictureBoxCruiser.Size = new Size(631, 651); pictureBoxPlane.Size = new Size(631, 651);
pictureBoxCruiser.TabIndex = 1; pictureBoxPlane.TabIndex = 1;
pictureBoxCruiser.TabStop = false; pictureBoxPlane.TabStop = false;
// //
// menuStrip // menuStrip
// //
@ -293,23 +293,23 @@
// //
openFileDialog.Filter = "txt file|*.txt"; openFileDialog.Filter = "txt file|*.txt";
// //
// FormCruisersCollection // FormPlanesCollection
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(853, 679); ClientSize = new Size(853, 679);
Controls.Add(pictureBoxCruiser); Controls.Add(pictureBoxPlane);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Controls.Add(menuStrip); Controls.Add(menuStrip);
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
Name = "FormCruisersCollection"; Name = "FormPlanesCollection";
Text = "FormCruisersCollection"; Text = "FormPlanesCollection";
groupBoxTools.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
panelStorage.ResumeLayout(false); panelStorage.ResumeLayout(false);
panelStorage.PerformLayout(); panelStorage.PerformLayout();
panelCompanyTools.ResumeLayout(false); panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout(); panelCompanyTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCruiser).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxPlane).EndInit();
menuStrip.ResumeLayout(false); menuStrip.ResumeLayout(false);
menuStrip.PerformLayout(); menuStrip.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
@ -320,11 +320,11 @@
private GroupBox groupBoxTools; private GroupBox groupBoxTools;
private ComboBox comboBoxSelectorCompany; private ComboBox comboBoxSelectorCompany;
private Button ButtonAddCruiser; private Button ButtonAddPlane;
private Button ButtonRemoveCruiser; private Button ButtonRemovePlane;
private Button buttonRefresh; private Button buttonRefresh;
private Button buttonGetToTest; private Button buttonGetToTest;
private PictureBox pictureBoxCruiser; private PictureBox pictureBoxPlane;
private MaskedTextBox maskedTextBoxPosision; private MaskedTextBox maskedTextBoxPosision;
private Panel panelStorage; private Panel panelStorage;
private TextBox textBoxCollectionName; private TextBox textBoxCollectionName;

View File

@ -1,15 +1,15 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ProjectCruiser.CollectionGenericObjects; using ProjectPlane.CollectionGenericObjects;
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
namespace ProjectCruiser namespace ProjectPlane
{ {
public partial class FormCruisersCollection : Form public partial class FormPlanesCollection : Form
{ {
/// <summary> /// <summary>
/// Хранилише коллекций /// Хранилише коллекций
/// </summary> /// </summary>
private readonly StorageCollection<DrawningCruiser> _storageCollection; private readonly StorageCollection<DrawningPlane> _storageCollection;
/// <summary> /// <summary>
/// Компания /// Компания
@ -24,7 +24,7 @@ namespace ProjectCruiser
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
public FormCruisersCollection(ILogger<FormCruisersCollection> logger) public FormPlanesCollection(ILogger<FormPlanesCollection> logger)
{ {
InitializeComponent(); InitializeComponent();
_storageCollection = new(); _storageCollection = new();
@ -42,35 +42,35 @@ namespace ProjectCruiser
} }
/// <summary> /// <summary>
/// добавление крейсера /// добавление самолета
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonAddCruiser_Click(object sender, EventArgs e) private void ButtonAddPlane_Click(object sender, EventArgs e)
{ {
FormCruiserConfing form = new(); FormPlaneConfing form = new();
// TODO передать метод // TODO передать метод
form.Show(); form.Show();
form.AddEvent(SetCruiser); form.AddEvent(SetPlane);
} }
/// <summary> /// <summary>
/// Добавление крейсера в коллекцию /// Добавление самолета в коллекцию
/// </summary> /// </summary>
/// <param name="cruiser"></param> /// <param name="plane"></param>
private void SetCruiser(DrawningCruiser? cruiser) private void SetPlane(DrawningPlane? plane)
{ {
if (_company == null || cruiser == null) if (_company == null || plane == null)
{ {
return; return;
} }
try try
{ {
var res = _company + cruiser; var res = _company + plane;
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
_logger.LogInformation($"Объект добавлен под индексом {res}"); _logger.LogInformation($"Объект добавлен под индексом {res}");
pictureBoxCruiser.Image = _company.Show(); pictureBoxPlane.Image = _company.Show();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -85,7 +85,7 @@ namespace ProjectCruiser
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonRemoveCruiser_Click(object sender, EventArgs e) private void ButtonRemovePlane_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(maskedTextBoxPosision.Text) || _company == null) if (string.IsNullOrEmpty(maskedTextBoxPosision.Text) || _company == null)
{ {
@ -102,7 +102,7 @@ namespace ProjectCruiser
var res = _company - pos; var res = _company - pos;
MessageBox.Show("Объект удален"); MessageBox.Show("Объект удален");
_logger.LogInformation($"Объект удален под индексом {pos}"); _logger.LogInformation($"Объект удален под индексом {pos}");
pictureBoxCruiser.Image = _company.Show(); pictureBoxPlane.Image = _company.Show();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -119,24 +119,24 @@ namespace ProjectCruiser
return; return;
} }
DrawningCruiser? cruiser = null; DrawningPlane? plane = null;
int counter = 100; int counter = 100;
while (cruiser == null) while (plane == null)
{ {
cruiser = _company.GetRandomObject(); plane = _company.GetRandomObject();
counter--; counter--;
if (counter <= 0) if (counter <= 0)
{ {
break; break;
} }
} }
if (cruiser == null) if (plane == null)
{ {
return; return;
} }
FormCruiser form = new() FormPlane form = new()
{ {
SetCruiser = cruiser SetPlane = plane
}; };
form.ShowDialog(); form.ShowDialog();
@ -149,7 +149,7 @@ namespace ProjectCruiser
return; return;
} }
pictureBoxCruiser.Image = _company.Show(); pictureBoxPlane.Image = _company.Show();
} }
/// <summary> /// <summary>
@ -237,7 +237,7 @@ namespace ProjectCruiser
return; return;
} }
ICollectionGenericObjects<DrawningCruiser>? collection = ICollectionGenericObjects<DrawningPlane>? collection =
_storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty]; _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
if (collection == null) if (collection == null)
{ {
@ -248,7 +248,7 @@ namespace ProjectCruiser
switch (comboBoxSelectorCompany.Text) switch (comboBoxSelectorCompany.Text)
{ {
case "Хранилище": case "Хранилище":
_company = new CruiserDockingService(pictureBoxCruiser.Width, pictureBoxCruiser.Height, collection); _company = new PlaneDockingService(pictureBoxPlane.Width, pictureBoxPlane.Height, collection);
_logger.LogInformation("Компания создана"); _logger.LogInformation("Компания создана");
break; break;
} }

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Класс-стратегия перемещения объекта /// Класс-стратегия перемещения объекта

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Интерфейс для работы с перемещаемым объектом /// Интерфейс для работы с перемещаемым объектом

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Стратегия перемещения объекта к краю экрана /// Стратегия перемещения объекта к краю экрана

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Стратегия перемещения объекта в центр экрана /// Стратегия перемещения объекта в центр экрана

View File

@ -1,45 +1,45 @@
using ProjectCruiser.Drawnings; using ProjectPlane.Drawnings;
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// класс реалтзация для IMoveableObject с использованием DrawningCruiser /// класс реалтзация для IMoveableObject с использованием DrawningPlane
/// </summary> /// </summary>
public class MoveableCruiser : IMoveableObject public class MoveablePlane : IMoveableObject
{ {
/// <summary> /// <summary>
/// Поле-объект класса DrawningCruiser или его наследника /// Поле-объект класса DrawningPlane или его наследника
/// </summary> /// </summary>
private readonly DrawningCruiser? _cruiser = null; private readonly DrawningPlane? _plane = null;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
/// <param name="cruiser">Объект класса DrawningCruiser</param> /// <param name="plane">Объект класса DrawningPlane</param>
public MoveableCruiser(DrawningCruiser cruiser) public MoveablePlane(DrawningPlane plane)
{ {
_cruiser = cruiser; _plane = plane;
} }
public ObjectParameters? GetObjectPosition public ObjectParameters? GetObjectPosition
{ {
get get
{ {
if (_cruiser == null || _cruiser.EntityCruiser == null || if (_plane == null || _plane.EntityPlane == null ||
!_cruiser.GetPosX.HasValue || !_cruiser.GetPosY.HasValue) !_plane.GetPosX.HasValue || !_plane.GetPosY.HasValue)
{ {
return null; return null;
} }
return new ObjectParameters(_cruiser.GetPosX.Value, return new ObjectParameters(_plane.GetPosX.Value,
_cruiser.GetPosY.Value, _cruiser.GetWidth, _cruiser.GetHeight); _plane.GetPosY.Value, _plane.GetWidth, _plane.GetHeight);
} }
} }
public int GetStep => (int)(_cruiser?.EntityCruiser?.Step ?? 0); public int GetStep => (int)(_plane?.EntityPlane?.Step ?? 0);
public bool TryMoveObject(MovementDirection direction) public bool TryMoveObject(MovementDirection direction)
{ {
if (_cruiser == null || _cruiser.EntityCruiser == null) if (_plane == null || _plane.EntityPlane == null)
{ {
return false; return false;
} }
return _cruiser.MoveTransport(GetDirectionType(direction)); return _plane.MoveTransport(GetDirectionType(direction));
} }
/// <summary> /// <summary>
/// Конвертация из MovementDirection в DirectionType /// Конвертация из MovementDirection в DirectionType

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Направление перемещения /// Направление перемещения

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Параметры-координаты объекта /// Параметры-координаты объекта

View File

@ -1,4 +1,4 @@
namespace ProjectCruiser.MovementStrategy namespace ProjectPlane.MovementStrategy
{ {
/// <summary> /// <summary>
/// Статус выполнения операции перемещения /// Статус выполнения операции перемещения

View File

@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Serilog; using Serilog;
namespace ProjectCruiser namespace ProjectPlane
{ {
internal static class Program internal static class Program
{ {
@ -18,12 +18,12 @@ namespace ProjectCruiser
ServiceCollection services = new(); ServiceCollection services = new();
ConfigureServices(services); ConfigureServices(services);
using ServiceProvider serviceProvider = services.BuildServiceProvider(); using ServiceProvider serviceProvider = services.BuildServiceProvider();
Application.Run(serviceProvider.GetRequiredService<FormCruisersCollection>()); Application.Run(serviceProvider.GetRequiredService<FormPlanesCollection>());
} }
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)
{ {
services.AddSingleton<FormCruisersCollection>().AddLogging(option => services.AddSingleton<FormPlanesCollection>().AddLogging(option =>
{ {
string[] path = Directory.GetCurrentDirectory().Split('\\'); string[] path = Directory.GetCurrentDirectory().Split('\\');
string pathNeed = ""; string pathNeed = "";

View File

@ -8,4 +8,15 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
</Project> </Project>

View File

@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" internalLogLevel="Info"> autoReload="true" internalLogLevel="Info">
<targets> <targets>
<target xsi:type="File" name="tofile" fileName="cruiserlog- <target xsi:type="File" name="tofile" fileName="planelog-
${shortdate}.log" /> ${shortdate}.log" />
</targets> </targets>
<rules> <rules>

View File

@ -14,7 +14,7 @@
], ],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ], "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": { "Properties": {
"Application": "cruiser" "Application": "plane"
} }
} }
} }