Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a0ac93219 | ||
|
|
4f2b31bf11 | ||
|
|
cffd746ec7 | ||
|
|
3070770d5a | ||
|
|
8647cc572a | ||
|
|
592059a118 |
@@ -1,6 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
60
ProjectBomber/ProjectBomber/DrawiningPlaneEqutables.cs
Normal file
60
ProjectBomber/ProjectBomber/DrawiningPlaneEqutables.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ProjectBomber.DrawningObjects;
|
||||||
|
using ProjectBomber.Entities;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace ProjectBomber.Generics
|
||||||
|
{
|
||||||
|
internal class DrawiningPlaneEqutables : IEqualityComparer<DrawningBomber>
|
||||||
|
{
|
||||||
|
public bool Equals(DrawningBomber x, DrawningBomber y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityBomber == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityBomber == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBomber.Speed != y.EntityBomber.Speed)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBomber.Weight != y.EntityBomber.Weight)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBomber.BodyColor != y.EntityBomber.BodyColor)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x is DrawningBomberAdvanced && y is DrawningBomberAdvanced)
|
||||||
|
{
|
||||||
|
EntityBomberAdvanced EntityX = (EntityBomberAdvanced)x.EntityBomber;
|
||||||
|
EntityBomberAdvanced EntityY = (EntityBomberAdvanced)y.EntityBomber;
|
||||||
|
if (EntityX.Bombs != EntityY.Bombs)
|
||||||
|
return false;
|
||||||
|
if (EntityX.FuelTanks != EntityY.FuelTanks)
|
||||||
|
return false;
|
||||||
|
if (EntityX.Line != EntityY.Line)
|
||||||
|
return false;
|
||||||
|
if (EntityX.AdditionalColor != EntityY.AdditionalColor)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public int GetHashCode(DrawningBomber obj)
|
||||||
|
{
|
||||||
|
return obj.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,11 +22,11 @@ namespace ProjectBomber.DrawningObjects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _pictureWidth;
|
public int _pictureWidth;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота окна
|
/// Высота окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _pictureHeight;
|
public int _pictureHeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата прорисовки бомбардировщика
|
/// Левая координата прорисовки бомбардировщика
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -280,5 +280,9 @@ namespace ProjectBomber.DrawningObjects
|
|||||||
// Рисуем контур линии
|
// Рисуем контур линии
|
||||||
g.DrawPath(pen, path1);
|
g.DrawPath(pen, path1);
|
||||||
}
|
}
|
||||||
|
public void setColor(Color color)
|
||||||
|
{
|
||||||
|
EntityBomber.setColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,13 @@ namespace ProjectBomber.DrawningObjects
|
|||||||
g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY + 34, 50, 2);
|
g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY + 34, 50, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void setAddColor(Color color)
|
||||||
|
{
|
||||||
|
if (EntityBomber is EntityBomberAdvanced bomber)
|
||||||
|
{
|
||||||
|
bomber.setAddColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,5 +40,9 @@ namespace ProjectBomber.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
public void setColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,5 +47,9 @@ namespace ProjectBomber.Entities
|
|||||||
FuelTanks = fuelTanks;
|
FuelTanks = fuelTanks;
|
||||||
Line = line;
|
Line = line;
|
||||||
}
|
}
|
||||||
|
public void setAddColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
ProjectBomber/ProjectBomber/ExtentionDrawningPlane.cs
Normal file
69
ProjectBomber/ProjectBomber/ExtentionDrawningPlane.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using ProjectBomber.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectBomber.DrawningObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Расширение для класса EntityBomber
|
||||||
|
/// </summary>
|
||||||
|
public static class ExtentionDrawningPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Создание объекта из строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">Строка с данными для создания объекта</param>
|
||||||
|
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||||
|
/// <param name="width">Ширина</param>
|
||||||
|
/// <param name="height">Высота</param>
|
||||||
|
/// <returns>Объект</returns>
|
||||||
|
public static DrawningBomber CreateDrawningPlane(this string info, char
|
||||||
|
separatorForObject, int width, int height)
|
||||||
|
{
|
||||||
|
string[] strs = info.Split(separatorForObject);
|
||||||
|
if (strs.Length == 3)
|
||||||
|
{
|
||||||
|
return new DrawningBomber(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||||
|
}
|
||||||
|
if (strs.Length == 7)
|
||||||
|
{
|
||||||
|
return new DrawningBomberAdvanced(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]),
|
||||||
|
Color.FromName(strs[2]),
|
||||||
|
Color.FromName(strs[3]),
|
||||||
|
Convert.ToBoolean(strs[4]),
|
||||||
|
Convert.ToBoolean(strs[5]),
|
||||||
|
Convert.ToBoolean(strs[6]), width, height);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение данных для сохранения в файл
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drawningPlane">Сохраняемый объект</param>
|
||||||
|
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||||
|
/// <returns>Строка с данными по объекту</returns>
|
||||||
|
public static string GetDataForSave(this DrawningBomber drawningPlane,
|
||||||
|
char separatorForObject)
|
||||||
|
{
|
||||||
|
var plane = drawningPlane.EntityBomber;
|
||||||
|
if (plane == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
var str = $"{plane.Speed}{separatorForObject}{plane.Weight}{separatorForObject}{plane.BodyColor.Name}";
|
||||||
|
if (!(plane is EntityBomberAdvanced bomberAdvanced))
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
$"{str}{separatorForObject}{bomberAdvanced.AdditionalColor.Name}{separatorForObject}{bomberAdvanced.Bombs}" +
|
||||||
|
$"{separatorForObject}{bomberAdvanced.FuelTanks}{separatorForObject}{bomberAdvanced.Line}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.ButtonSortByColor = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonSortByType = new System.Windows.Forms.Button();
|
||||||
this.groupBoxSet = new System.Windows.Forms.GroupBox();
|
this.groupBoxSet = new System.Windows.Forms.GroupBox();
|
||||||
this.ButtonDelObject = new System.Windows.Forms.Button();
|
this.ButtonDelObject = new System.Windows.Forms.Button();
|
||||||
this.ListBoxStorages = new System.Windows.Forms.ListBox();
|
this.ListBoxStorages = new System.Windows.Forms.ListBox();
|
||||||
@@ -38,7 +40,13 @@
|
|||||||
this.ButtonRemovePlane = new System.Windows.Forms.Button();
|
this.ButtonRemovePlane = new System.Windows.Forms.Button();
|
||||||
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||||
this.ButtonAddPlane = new System.Windows.Forms.Button();
|
this.ButtonAddPlane = new System.Windows.Forms.Button();
|
||||||
|
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||||
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBoxSet.SuspendLayout();
|
this.groupBoxSet.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||||
@@ -46,27 +54,50 @@
|
|||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.ButtonSortByColor);
|
||||||
|
this.groupBox1.Controls.Add(this.ButtonSortByType);
|
||||||
this.groupBox1.Controls.Add(this.groupBoxSet);
|
this.groupBox1.Controls.Add(this.groupBoxSet);
|
||||||
this.groupBox1.Controls.Add(this.ButtonRefreshCollection);
|
this.groupBox1.Controls.Add(this.ButtonRefreshCollection);
|
||||||
this.groupBox1.Controls.Add(this.ButtonRemovePlane);
|
this.groupBox1.Controls.Add(this.ButtonRemovePlane);
|
||||||
this.groupBox1.Controls.Add(this.maskedTextBoxNumber);
|
this.groupBox1.Controls.Add(this.maskedTextBoxNumber);
|
||||||
this.groupBox1.Controls.Add(this.ButtonAddPlane);
|
this.groupBox1.Controls.Add(this.ButtonAddPlane);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(586, 2);
|
this.groupBox1.Controls.Add(this.menuStrip);
|
||||||
|
this.groupBox1.Location = new System.Drawing.Point(592, 2);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(216, 563);
|
this.groupBox1.Size = new System.Drawing.Size(210, 563);
|
||||||
this.groupBox1.TabIndex = 0;
|
this.groupBox1.TabIndex = 0;
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Инструменты";
|
this.groupBox1.Text = "Инструменты";
|
||||||
//
|
//
|
||||||
|
// ButtonSortByColor
|
||||||
|
//
|
||||||
|
this.ButtonSortByColor.Location = new System.Drawing.Point(20, 333);
|
||||||
|
this.ButtonSortByColor.Name = "ButtonSortByColor";
|
||||||
|
this.ButtonSortByColor.Size = new System.Drawing.Size(181, 28);
|
||||||
|
this.ButtonSortByColor.TabIndex = 7;
|
||||||
|
this.ButtonSortByColor.Text = "Сортировка по цвету";
|
||||||
|
this.ButtonSortByColor.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSortByColor.Click += new System.EventHandler(this.ButtonSortByColor_Click);
|
||||||
|
//
|
||||||
|
// ButtonSortByType
|
||||||
|
//
|
||||||
|
this.ButtonSortByType.Location = new System.Drawing.Point(20, 294);
|
||||||
|
this.ButtonSortByType.Name = "ButtonSortByType";
|
||||||
|
this.ButtonSortByType.Size = new System.Drawing.Size(180, 33);
|
||||||
|
this.ButtonSortByType.TabIndex = 6;
|
||||||
|
this.ButtonSortByType.Text = "Сортировка по типу";
|
||||||
|
this.ButtonSortByType.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSortByType.Click += new System.EventHandler(this.ButtonSortByType_Click);
|
||||||
|
//
|
||||||
// groupBoxSet
|
// groupBoxSet
|
||||||
//
|
//
|
||||||
this.groupBoxSet.Controls.Add(this.ButtonDelObject);
|
this.groupBoxSet.Controls.Add(this.ButtonDelObject);
|
||||||
this.groupBoxSet.Controls.Add(this.ListBoxStorages);
|
this.groupBoxSet.Controls.Add(this.ListBoxStorages);
|
||||||
this.groupBoxSet.Controls.Add(this.ButtonAddObject);
|
this.groupBoxSet.Controls.Add(this.ButtonAddObject);
|
||||||
this.groupBoxSet.Controls.Add(this.textBoxStorageName);
|
this.groupBoxSet.Controls.Add(this.textBoxStorageName);
|
||||||
this.groupBoxSet.Location = new System.Drawing.Point(21, 25);
|
this.groupBoxSet.Location = new System.Drawing.Point(21, 19);
|
||||||
this.groupBoxSet.Name = "groupBoxSet";
|
this.groupBoxSet.Name = "groupBoxSet";
|
||||||
this.groupBoxSet.Size = new System.Drawing.Size(180, 274);
|
this.groupBoxSet.Size = new System.Drawing.Size(180, 269);
|
||||||
this.groupBoxSet.TabIndex = 4;
|
this.groupBoxSet.TabIndex = 4;
|
||||||
this.groupBoxSet.TabStop = false;
|
this.groupBoxSet.TabStop = false;
|
||||||
this.groupBoxSet.Text = "Наборы";
|
this.groupBoxSet.Text = "Наборы";
|
||||||
@@ -109,9 +140,9 @@
|
|||||||
//
|
//
|
||||||
// ButtonRefreshCollection
|
// ButtonRefreshCollection
|
||||||
//
|
//
|
||||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(18, 509);
|
this.ButtonRefreshCollection.Location = new System.Drawing.Point(21, 492);
|
||||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(178, 41);
|
this.ButtonRefreshCollection.Size = new System.Drawing.Size(177, 41);
|
||||||
this.ButtonRefreshCollection.TabIndex = 3;
|
this.ButtonRefreshCollection.TabIndex = 3;
|
||||||
this.ButtonRefreshCollection.Text = "Обновить коллекцию";
|
this.ButtonRefreshCollection.Text = "Обновить коллекцию";
|
||||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||||
@@ -119,7 +150,7 @@
|
|||||||
//
|
//
|
||||||
// ButtonRemovePlane
|
// ButtonRemovePlane
|
||||||
//
|
//
|
||||||
this.ButtonRemovePlane.Location = new System.Drawing.Point(18, 430);
|
this.ButtonRemovePlane.Location = new System.Drawing.Point(21, 445);
|
||||||
this.ButtonRemovePlane.Name = "ButtonRemovePlane";
|
this.ButtonRemovePlane.Name = "ButtonRemovePlane";
|
||||||
this.ButtonRemovePlane.Size = new System.Drawing.Size(179, 41);
|
this.ButtonRemovePlane.Size = new System.Drawing.Size(179, 41);
|
||||||
this.ButtonRemovePlane.TabIndex = 2;
|
this.ButtonRemovePlane.TabIndex = 2;
|
||||||
@@ -129,29 +160,70 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxNumber
|
// maskedTextBoxNumber
|
||||||
//
|
//
|
||||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(18, 388);
|
this.maskedTextBoxNumber.Location = new System.Drawing.Point(21, 413);
|
||||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(180, 20);
|
this.maskedTextBoxNumber.Size = new System.Drawing.Size(180, 20);
|
||||||
this.maskedTextBoxNumber.TabIndex = 1;
|
this.maskedTextBoxNumber.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// ButtonAddPlane
|
// ButtonAddPlane
|
||||||
//
|
//
|
||||||
this.ButtonAddPlane.Location = new System.Drawing.Point(18, 327);
|
this.ButtonAddPlane.Location = new System.Drawing.Point(21, 367);
|
||||||
this.ButtonAddPlane.Name = "ButtonAddPlane";
|
this.ButtonAddPlane.Name = "ButtonAddPlane";
|
||||||
this.ButtonAddPlane.Size = new System.Drawing.Size(185, 40);
|
this.ButtonAddPlane.Size = new System.Drawing.Size(180, 40);
|
||||||
this.ButtonAddPlane.TabIndex = 0;
|
this.ButtonAddPlane.TabIndex = 0;
|
||||||
this.ButtonAddPlane.Text = "Добавить самолет";
|
this.ButtonAddPlane.Text = "Добавить самолет";
|
||||||
this.ButtonAddPlane.UseVisualStyleBackColor = true;
|
this.ButtonAddPlane.UseVisualStyleBackColor = true;
|
||||||
this.ButtonAddPlane.Click += new System.EventHandler(this.ButtonAddPlane_Click);
|
this.ButtonAddPlane.Click += new System.EventHandler(this.ButtonAddPlane_Click);
|
||||||
//
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(3, 536);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(204, 24);
|
||||||
|
this.menuStrip.TabIndex = 5;
|
||||||
|
this.menuStrip.Text = "menuStrip";
|
||||||
|
//
|
||||||
|
// fileToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.saveToolStripMenuItem,
|
||||||
|
this.loadToolStripMenuItem});
|
||||||
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||||
|
this.fileToolStripMenuItem.Text = "File";
|
||||||
|
//
|
||||||
|
// saveToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
|
this.saveToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
||||||
|
this.saveToolStripMenuItem.Text = "Save";
|
||||||
|
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// loadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||||
|
this.loadToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
||||||
|
this.loadToolStripMenuItem.Text = "Load";
|
||||||
|
this.loadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// pictureBoxCollection
|
// pictureBoxCollection
|
||||||
//
|
//
|
||||||
this.pictureBoxCollection.Location = new System.Drawing.Point(-2, 2);
|
this.pictureBoxCollection.Location = new System.Drawing.Point(1, 2);
|
||||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||||
this.pictureBoxCollection.Size = new System.Drawing.Size(600, 563);
|
this.pictureBoxCollection.Size = new System.Drawing.Size(600, 565);
|
||||||
this.pictureBoxCollection.TabIndex = 1;
|
this.pictureBoxCollection.TabIndex = 0;
|
||||||
this.pictureBoxCollection.TabStop = false;
|
this.pictureBoxCollection.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// openFileDialog
|
||||||
|
//
|
||||||
|
this.openFileDialog.FileName = "openFileDialog";
|
||||||
|
this.openFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
this.saveFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
// FormPlaneCollection
|
// FormPlaneCollection
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -159,6 +231,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(800, 564);
|
this.ClientSize = new System.Drawing.Size(800, 564);
|
||||||
this.Controls.Add(this.pictureBoxCollection);
|
this.Controls.Add(this.pictureBoxCollection);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
|
this.MainMenuStrip = this.menuStrip;
|
||||||
this.Name = "FormPlaneCollection";
|
this.Name = "FormPlaneCollection";
|
||||||
this.Text = "Набор самолетов";
|
this.Text = "Набор самолетов";
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
@@ -183,5 +256,13 @@
|
|||||||
private System.Windows.Forms.ListBox ListBoxStorages;
|
private System.Windows.Forms.ListBox ListBoxStorages;
|
||||||
private System.Windows.Forms.Button ButtonAddObject;
|
private System.Windows.Forms.Button ButtonAddObject;
|
||||||
private System.Windows.Forms.TextBox textBoxStorageName;
|
private System.Windows.Forms.TextBox textBoxStorageName;
|
||||||
|
private System.Windows.Forms.MenuStrip menuStrip;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
||||||
|
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
||||||
|
private System.Windows.Forms.Button ButtonSortByColor;
|
||||||
|
private System.Windows.Forms.Button ButtonSortByType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,8 @@ using System.Windows.Forms;
|
|||||||
using ProjectBomber.MovementStrategy;
|
using ProjectBomber.MovementStrategy;
|
||||||
using ProjectBomber.Generics;
|
using ProjectBomber.Generics;
|
||||||
using ProjectBomber.DrawningObjects;
|
using ProjectBomber.DrawningObjects;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ProjectBomber
|
namespace ProjectBomber
|
||||||
{
|
{
|
||||||
@@ -23,12 +25,17 @@ namespace ProjectBomber
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly PlanesGenericStorage _storage;
|
private readonly PlanesGenericStorage _storage;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Логер
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormPlaneCollection()
|
public FormPlaneCollection(ILogger<FormPlaneCollection> logger)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_storage = new PlanesGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
_storage = new PlanesGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Заполнение listBoxObjects
|
/// Заполнение listBoxObjects
|
||||||
@@ -39,7 +46,7 @@ namespace ProjectBomber
|
|||||||
ListBoxStorages.Items.Clear();
|
ListBoxStorages.Items.Clear();
|
||||||
for (int i = 0; i < _storage.Keys.Count; i++)
|
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||||
{
|
{
|
||||||
ListBoxStorages.Items.Add(_storage.Keys[i]);
|
ListBoxStorages.Items.Add(_storage.Keys[i].Name);
|
||||||
}
|
}
|
||||||
if (ListBoxStorages.Items.Count > 0 && (index == -1 || index
|
if (ListBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||||
>= ListBoxStorages.Items.Count))
|
>= ListBoxStorages.Items.Count))
|
||||||
@@ -63,10 +70,12 @@ namespace ProjectBomber
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Пустое название набора");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_storage.AddSet(textBoxStorageName.Text);
|
_storage.AddSet(textBoxStorageName.Text);
|
||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
|
_logger.LogInformation($"Добавлен набор:{ textBoxStorageName.Text} ");
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Выбор набора
|
/// Выбор набора
|
||||||
@@ -87,13 +96,44 @@ _storage[ListBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowPlanes()
|
|||||||
{
|
{
|
||||||
if (ListBoxStorages.SelectedIndex == -1)
|
if (ListBoxStorages.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning("Удаление невыбранного набора");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MessageBox.Show($"Удалить объект {ListBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
|
string name = ListBoxStorages.SelectedItem.ToString() ?? string.Empty;
|
||||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
|
if (MessageBox.Show($"Удалить объект {name}?", "Удаление", MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
_storage.DelSet(ListBoxStorages.SelectedItem.ToString()?? string.Empty);
|
_storage.DelSet(ListBoxStorages.SelectedItem.ToString()
|
||||||
|
?? string.Empty);
|
||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
|
_logger.LogInformation($"Удален набор: {name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddPlane(DrawningBomber plane)
|
||||||
|
{
|
||||||
|
if (ListBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Добавление пустого объекта");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_ = obj + plane;
|
||||||
|
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
_logger.LogInformation($"Добавлен объект в набор {ListBoxStorages.SelectedItem.ToString()}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
_logger.LogWarning($"{ex.Message} в наборе {ListBoxStorages.SelectedItem.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -105,42 +145,34 @@ MessageBoxIcon.Question) == DialogResult.Yes)
|
|||||||
{
|
{
|
||||||
if (ListBoxStorages.SelectedIndex == -1)
|
if (ListBoxStorages.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning($"Неудачная попытка добавить объект: набор не выбран");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ??
|
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
string.Empty];
|
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormBomber form = new FormBomber();
|
var formPlaneConfig = new FormPlaneConfig();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
formPlaneConfig.Show();
|
||||||
{
|
formPlaneConfig.AddEvent(AddPlane);
|
||||||
if (obj + form.SelectedBomber)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта из набора
|
/// Удаление объекта из набора
|
||||||
/// </summary>
|
/// </summary>labelModifiedObject
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonRemovePlane_Click(object sender, EventArgs e)
|
private void ButtonRemovePlane_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ListBoxStorages.SelectedIndex == -1)
|
if (ListBoxStorages.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning("Удаление объекта из несуществующего набора");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning($"Ошибка удаления объекта из набора: место в наборе пусто");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||||
@@ -149,14 +181,24 @@ MessageBoxIcon.Question) == DialogResult.Yes)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||||
if (obj - pos != null)
|
try
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
if (obj - pos != null)
|
||||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
_logger.LogInformation($"Удален объект из набора {ListBoxStorages.SelectedItem.ToString()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
_logger.LogWarning($"Не удалось удалить объект из набора {ListBoxStorages.SelectedItem.ToString()}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch(PlaneNotFoundException ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
MessageBox.Show(ex.Message);
|
||||||
|
_logger.LogWarning($"{ex.Message} из набора {ListBoxStorages.SelectedItem.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -178,5 +220,73 @@ MessageBoxIcon.Question) == DialogResult.Yes)
|
|||||||
}
|
}
|
||||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка нажатия "Сохранение"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_storage.SaveData(saveFileDialog.FileName);
|
||||||
|
MessageBox.Show("Сохранение прошло успешно",
|
||||||
|
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
_logger.LogInformation($"Сохранение наборов в файл {saveFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не сохранилось: {ex.Message}",
|
||||||
|
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning($"Не удалось сохранить наборы с ошибкой: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка нажатия "Загрузка"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_storage.LoadData(openFileDialog.FileName);
|
||||||
|
MessageBox.Show("Данные успешно загружены.", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
ReloadObjects();
|
||||||
|
_logger.LogInformation($"Загрузились наборы из файла {openFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не загрузилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning($"Не удалось сохранить наборы с ошибкой: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonSortByType_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByType());
|
||||||
|
private void ButtonSortByColor_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByColor());
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка по сравнителю
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
private void ComparePlanes(IComparer<DrawningBomber> comparer)
|
||||||
|
{
|
||||||
|
if (ListBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[ListBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obj.Sort(comparer);
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,4 +117,16 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>132, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>244, 19</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
382
ProjectBomber/ProjectBomber/FormPlaneConfig.Designer.cs
generated
Normal file
382
ProjectBomber/ProjectBomber/FormPlaneConfig.Designer.cs
generated
Normal file
@@ -0,0 +1,382 @@
|
|||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
partial class FormPlaneConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelPurple = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlack = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGray = new System.Windows.Forms.Panel();
|
||||||
|
this.panelWhite = new System.Windows.Forms.Panel();
|
||||||
|
this.panelYellow = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGreen = new System.Windows.Forms.Panel();
|
||||||
|
this.panelRed = new System.Windows.Forms.Panel();
|
||||||
|
this.checkBoxLine = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBoxFuelTanks = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.checkBoxBombs = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.panelObject = new System.Windows.Forms.Panel();
|
||||||
|
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelAddColor = new System.Windows.Forms.Label();
|
||||||
|
this.labelColor = new System.Windows.Forms.Label();
|
||||||
|
this.ButtonOk = new System.Windows.Forms.Button();
|
||||||
|
this.buttonCanel = new System.Windows.Forms.Button();
|
||||||
|
this.groupBox1.SuspendLayout();
|
||||||
|
this.groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
this.panelObject.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.labelModifiedObject);
|
||||||
|
this.groupBox1.Controls.Add(this.labelSimpleObject);
|
||||||
|
this.groupBox1.Controls.Add(this.groupBoxColors);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxLine);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxFuelTanks);
|
||||||
|
this.groupBox1.Controls.Add(this.numericUpDownWeight);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxBombs);
|
||||||
|
this.groupBox1.Controls.Add(this.numericUpDownSpeed);
|
||||||
|
this.groupBox1.Controls.Add(this.label2);
|
||||||
|
this.groupBox1.Controls.Add(this.label1);
|
||||||
|
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.groupBox1.Name = "groupBox1";
|
||||||
|
this.groupBox1.Size = new System.Drawing.Size(530, 225);
|
||||||
|
this.groupBox1.TabIndex = 0;
|
||||||
|
this.groupBox1.TabStop = false;
|
||||||
|
this.groupBox1.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelModifiedObject.Location = new System.Drawing.Point(400, 183);
|
||||||
|
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
this.labelModifiedObject.Size = new System.Drawing.Size(93, 31);
|
||||||
|
this.labelModifiedObject.TabIndex = 9;
|
||||||
|
this.labelModifiedObject.Text = "Продвинутый";
|
||||||
|
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelSimpleObject.Location = new System.Drawing.Point(273, 183);
|
||||||
|
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
this.labelSimpleObject.Size = new System.Drawing.Size(99, 31);
|
||||||
|
this.labelSimpleObject.TabIndex = 8;
|
||||||
|
this.labelSimpleObject.Text = "Простой";
|
||||||
|
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPurple);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlack);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelGray);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelWhite);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelYellow);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlue);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelGreen);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelRed);
|
||||||
|
this.groupBoxColors.Location = new System.Drawing.Point(273, 32);
|
||||||
|
this.groupBoxColors.Name = "groupBoxColors";
|
||||||
|
this.groupBoxColors.Size = new System.Drawing.Size(245, 120);
|
||||||
|
this.groupBoxColors.TabIndex = 7;
|
||||||
|
this.groupBoxColors.TabStop = false;
|
||||||
|
this.groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelPurple
|
||||||
|
//
|
||||||
|
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||||
|
this.panelPurple.Location = new System.Drawing.Point(192, 73);
|
||||||
|
this.panelPurple.Name = "panelPurple";
|
||||||
|
this.panelPurple.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelPurple.TabIndex = 7;
|
||||||
|
this.panelPurple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(130, 73);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelBlack.TabIndex = 6;
|
||||||
|
this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelGray
|
||||||
|
//
|
||||||
|
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
||||||
|
this.panelGray.Location = new System.Drawing.Point(68, 73);
|
||||||
|
this.panelGray.Name = "panelGray";
|
||||||
|
this.panelGray.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelGray.TabIndex = 5;
|
||||||
|
this.panelGray.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(6, 73);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelWhite.TabIndex = 4;
|
||||||
|
this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||||
|
this.panelYellow.Location = new System.Drawing.Point(192, 19);
|
||||||
|
this.panelYellow.Name = "panelYellow";
|
||||||
|
this.panelYellow.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelYellow.TabIndex = 3;
|
||||||
|
this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(130, 19);
|
||||||
|
this.panelBlue.Name = "panelBlue";
|
||||||
|
this.panelBlue.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelBlue.TabIndex = 2;
|
||||||
|
this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelGreen
|
||||||
|
//
|
||||||
|
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||||
|
this.panelGreen.Location = new System.Drawing.Point(68, 19);
|
||||||
|
this.panelGreen.Name = "panelGreen";
|
||||||
|
this.panelGreen.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelGreen.TabIndex = 1;
|
||||||
|
this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||||
|
this.panelRed.Location = new System.Drawing.Point(6, 19);
|
||||||
|
this.panelRed.Name = "panelRed";
|
||||||
|
this.panelRed.Size = new System.Drawing.Size(45, 40);
|
||||||
|
this.panelRed.TabIndex = 0;
|
||||||
|
this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// checkBoxLine
|
||||||
|
//
|
||||||
|
this.checkBoxLine.AutoSize = true;
|
||||||
|
this.checkBoxLine.Location = new System.Drawing.Point(30, 183);
|
||||||
|
this.checkBoxLine.Name = "checkBoxLine";
|
||||||
|
this.checkBoxLine.Size = new System.Drawing.Size(155, 17);
|
||||||
|
this.checkBoxLine.TabIndex = 6;
|
||||||
|
this.checkBoxLine.Text = "Признак наличия полосы";
|
||||||
|
this.checkBoxLine.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxFuelTanks
|
||||||
|
//
|
||||||
|
this.checkBoxFuelTanks.AutoSize = true;
|
||||||
|
this.checkBoxFuelTanks.Location = new System.Drawing.Point(30, 149);
|
||||||
|
this.checkBoxFuelTanks.Name = "checkBoxFuelTanks";
|
||||||
|
this.checkBoxFuelTanks.Size = new System.Drawing.Size(204, 17);
|
||||||
|
this.checkBoxFuelTanks.TabIndex = 5;
|
||||||
|
this.checkBoxFuelTanks.Text = "Признак наличия топливных баков";
|
||||||
|
this.checkBoxFuelTanks.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
this.numericUpDownWeight.Location = new System.Drawing.Point(91, 71);
|
||||||
|
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
|
this.numericUpDownWeight.Size = new System.Drawing.Size(75, 20);
|
||||||
|
this.numericUpDownWeight.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// checkBoxBombs
|
||||||
|
//
|
||||||
|
this.checkBoxBombs.AutoSize = true;
|
||||||
|
this.checkBoxBombs.Location = new System.Drawing.Point(30, 116);
|
||||||
|
this.checkBoxBombs.Name = "checkBoxBombs";
|
||||||
|
this.checkBoxBombs.Size = new System.Drawing.Size(143, 17);
|
||||||
|
this.checkBoxBombs.TabIndex = 3;
|
||||||
|
this.checkBoxBombs.Text = "Признак наличия бомб";
|
||||||
|
this.checkBoxBombs.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
this.numericUpDownSpeed.Increment = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(91, 32);
|
||||||
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||||
|
this.numericUpDownSpeed.Size = new System.Drawing.Size(75, 20);
|
||||||
|
this.numericUpDownSpeed.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(27, 73);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(29, 13);
|
||||||
|
this.label2.TabIndex = 1;
|
||||||
|
this.label2.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(27, 32);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(58, 13);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// panelObject
|
||||||
|
//
|
||||||
|
this.panelObject.AllowDrop = true;
|
||||||
|
this.panelObject.Controls.Add(this.pictureBoxObject);
|
||||||
|
this.panelObject.Controls.Add(this.labelAddColor);
|
||||||
|
this.panelObject.Controls.Add(this.labelColor);
|
||||||
|
this.panelObject.Location = new System.Drawing.Point(558, 12);
|
||||||
|
this.panelObject.Name = "panelObject";
|
||||||
|
this.panelObject.Size = new System.Drawing.Size(230, 187);
|
||||||
|
this.panelObject.TabIndex = 1;
|
||||||
|
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
this.pictureBoxObject.Location = new System.Drawing.Point(19, 48);
|
||||||
|
this.pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
this.pictureBoxObject.Size = new System.Drawing.Size(190, 125);
|
||||||
|
this.pictureBoxObject.TabIndex = 2;
|
||||||
|
this.pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelAddColor
|
||||||
|
//
|
||||||
|
this.labelAddColor.AllowDrop = true;
|
||||||
|
this.labelAddColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelAddColor.Location = new System.Drawing.Point(122, 18);
|
||||||
|
this.labelAddColor.Name = "labelAddColor";
|
||||||
|
this.labelAddColor.Size = new System.Drawing.Size(88, 27);
|
||||||
|
this.labelAddColor.TabIndex = 1;
|
||||||
|
this.labelAddColor.Text = "Доп. цвет";
|
||||||
|
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragDrop);
|
||||||
|
this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
this.labelColor.AllowDrop = true;
|
||||||
|
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelColor.Location = new System.Drawing.Point(17, 18);
|
||||||
|
this.labelColor.Name = "labelColor";
|
||||||
|
this.labelColor.Size = new System.Drawing.Size(86, 27);
|
||||||
|
this.labelColor.TabIndex = 0;
|
||||||
|
this.labelColor.Text = "Цвет";
|
||||||
|
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// ButtonOk
|
||||||
|
//
|
||||||
|
this.ButtonOk.Location = new System.Drawing.Point(577, 210);
|
||||||
|
this.ButtonOk.Name = "ButtonOk";
|
||||||
|
this.ButtonOk.Size = new System.Drawing.Size(84, 27);
|
||||||
|
this.ButtonOk.TabIndex = 2;
|
||||||
|
this.ButtonOk.Text = "Добавить";
|
||||||
|
this.ButtonOk.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
|
//
|
||||||
|
// buttonCanel
|
||||||
|
//
|
||||||
|
this.buttonCanel.Location = new System.Drawing.Point(683, 210);
|
||||||
|
this.buttonCanel.Name = "buttonCanel";
|
||||||
|
this.buttonCanel.Size = new System.Drawing.Size(84, 27);
|
||||||
|
this.buttonCanel.TabIndex = 3;
|
||||||
|
this.buttonCanel.Text = "Отмена";
|
||||||
|
this.buttonCanel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// FormPlaneConfig
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 243);
|
||||||
|
this.Controls.Add(this.buttonCanel);
|
||||||
|
this.Controls.Add(this.ButtonOk);
|
||||||
|
this.Controls.Add(this.panelObject);
|
||||||
|
this.Controls.Add(this.groupBox1);
|
||||||
|
this.Name = "FormPlaneConfig";
|
||||||
|
this.Text = "FormPlaneConfig";
|
||||||
|
this.groupBox1.ResumeLayout(false);
|
||||||
|
this.groupBox1.PerformLayout();
|
||||||
|
this.groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
this.panelObject.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
|
private System.Windows.Forms.NumericUpDown numericUpDownWeight;
|
||||||
|
private System.Windows.Forms.CheckBox checkBoxBombs;
|
||||||
|
private System.Windows.Forms.NumericUpDown numericUpDownSpeed;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.CheckBox checkBoxFuelTanks;
|
||||||
|
private System.Windows.Forms.Label labelModifiedObject;
|
||||||
|
private System.Windows.Forms.Label labelSimpleObject;
|
||||||
|
private System.Windows.Forms.GroupBox groupBoxColors;
|
||||||
|
private System.Windows.Forms.Panel panelPurple;
|
||||||
|
private System.Windows.Forms.Panel panelBlack;
|
||||||
|
private System.Windows.Forms.Panel panelGray;
|
||||||
|
private System.Windows.Forms.Panel panelWhite;
|
||||||
|
private System.Windows.Forms.Panel panelYellow;
|
||||||
|
private System.Windows.Forms.Panel panelBlue;
|
||||||
|
private System.Windows.Forms.Panel panelGreen;
|
||||||
|
private System.Windows.Forms.Panel panelRed;
|
||||||
|
private System.Windows.Forms.CheckBox checkBoxLine;
|
||||||
|
private System.Windows.Forms.Panel panelObject;
|
||||||
|
private System.Windows.Forms.PictureBox pictureBoxObject;
|
||||||
|
private System.Windows.Forms.Label labelAddColor;
|
||||||
|
private System.Windows.Forms.Label labelColor;
|
||||||
|
private System.Windows.Forms.Button ButtonOk;
|
||||||
|
private System.Windows.Forms.Button buttonCanel;
|
||||||
|
}
|
||||||
|
}
|
||||||
176
ProjectBomber/ProjectBomber/FormPlaneConfig.cs
Normal file
176
ProjectBomber/ProjectBomber/FormPlaneConfig.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
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;
|
||||||
|
using ProjectBomber.DrawningObjects;
|
||||||
|
using ProjectBomber.Entities;
|
||||||
|
|
||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
public partial class FormPlaneConfig : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная-выбранный самолет
|
||||||
|
/// </summary>
|
||||||
|
DrawningBomber _plane = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
private event Action<DrawningBomber> EventAddPlane;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormPlaneConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelGray.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
buttonCanel.Click += (s, e) => Close();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовать самолет
|
||||||
|
/// </summary>
|
||||||
|
private void DrawPlane()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new Bitmap(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_plane?.SetPosition(5, 5);
|
||||||
|
_plane?.DrawTransport(gr);
|
||||||
|
if (_plane is DrawningBomber)
|
||||||
|
(_plane as DrawningBomber).DrawTransport(gr);
|
||||||
|
else
|
||||||
|
_plane?.DrawTransport(gr);
|
||||||
|
pictureBoxObject.Image = bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Действия при приеме перетаскиваемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelSimpleObject":
|
||||||
|
_plane = new DrawningBomber((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||||
|
pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_plane = new DrawningBomberAdvanced((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBombs.Checked,
|
||||||
|
checkBoxFuelTanks.Checked, checkBoxLine.Checked, pictureBoxObject.Width,
|
||||||
|
pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev">Привязанный метод</param>
|
||||||
|
public void AddEvent(Action<DrawningBomber> ev)
|
||||||
|
{
|
||||||
|
if (EventAddPlane == null)
|
||||||
|
{
|
||||||
|
EventAddPlane = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddPlane += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление машины
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddPlane?.Invoke(_plane);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Передаем информацию при нажатии на Label
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Действия при приеме перетаскиваемой информации об обычном цвете
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_plane is DrawningBomber plane)
|
||||||
|
{
|
||||||
|
labelColor.BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
plane.setColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
private void LabelAddColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_plane is DrawningBomberAdvanced bomber)
|
||||||
|
{
|
||||||
|
labelAddColor.BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
bomber.setAddColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice maxOccurs="unbounded">
|
<xsd:choice maxOccurs="unbounded">
|
||||||
@@ -68,9 +69,10 @@
|
|||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="assembly">
|
<xsd:element name="assembly">
|
||||||
@@ -85,9 +87,10 @@
|
|||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
<xsd:element name="resheader">
|
<xsd:element name="resheader">
|
||||||
@@ -109,9 +112,9 @@
|
|||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
</root>
|
</root>
|
||||||
45
ProjectBomber/ProjectBomber/PlaneCompareByColor.cs
Normal file
45
ProjectBomber/ProjectBomber/PlaneCompareByColor.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ProjectBomber.Entities;
|
||||||
|
using ProjectBomber.DrawningObjects;
|
||||||
|
|
||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
internal class PlaneCompareByColor : IComparer<DrawningBomber>
|
||||||
|
{
|
||||||
|
public int Compare(DrawningBomber x, DrawningBomber y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityBomber == null)
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
if (y == null || y.EntityBomber == null)
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
if (x.EntityBomber.BodyColor.Name != y.EntityBomber.BodyColor.Name)
|
||||||
|
{
|
||||||
|
return x.EntityBomber.BodyColor.Name.CompareTo(y.EntityBomber.BodyColor.Name);
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
if (x is DrawningBomber)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (x.GetType().Name == y.GetType().Name && x is DrawningBomberAdvanced)
|
||||||
|
{
|
||||||
|
EntityBomberAdvanced EntityX = (EntityBomberAdvanced)x.EntityBomber;
|
||||||
|
EntityBomberAdvanced EntityY = (EntityBomberAdvanced)y.EntityBomber;
|
||||||
|
if (EntityX.AdditionalColor.Name != EntityY.AdditionalColor.Name)
|
||||||
|
{
|
||||||
|
return EntityX.AdditionalColor.Name.CompareTo(EntityY.AdditionalColor.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var speedCompare = x.EntityBomber.Speed.CompareTo(y.EntityBomber.Speed);
|
||||||
|
if (speedCompare != 0)
|
||||||
|
return speedCompare;
|
||||||
|
return x.EntityBomber.Weight.CompareTo(y.EntityBomber.Weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
ProjectBomber/ProjectBomber/PlaneCompareByType.cs
Normal file
35
ProjectBomber/ProjectBomber/PlaneCompareByType.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ProjectBomber.Entities;
|
||||||
|
using ProjectBomber.DrawningObjects;
|
||||||
|
|
||||||
|
namespace ProjectBomber.Generics
|
||||||
|
{
|
||||||
|
internal class PlaneCompareByType : IComparer<DrawningBomber>
|
||||||
|
{
|
||||||
|
public int Compare(DrawningBomber x, DrawningBomber y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityBomber == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityBomber == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return x.GetType().Name.CompareTo(y.GetType().Name);
|
||||||
|
}
|
||||||
|
var speedCompare = x.EntityBomber.Speed.CompareTo(y.EntityBomber.Speed);
|
||||||
|
if (speedCompare != 0)
|
||||||
|
{
|
||||||
|
return speedCompare;
|
||||||
|
}
|
||||||
|
return x.EntityBomber.Weight.CompareTo(y.EntityBomber.Weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
ProjectBomber/ProjectBomber/PlaneNotFoundException.cs
Normal file
20
ProjectBomber/ProjectBomber/PlaneNotFoundException.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class PlaneNotFoundException : ApplicationException
|
||||||
|
{
|
||||||
|
public PlaneNotFoundException(int i) : base($"Не найден объект по позиции { i}") { }
|
||||||
|
public PlaneNotFoundException() : base() { }
|
||||||
|
public PlaneNotFoundException(string message) : base(message) { }
|
||||||
|
public PlaneNotFoundException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected PlaneNotFoundException(SerializationInfo info,
|
||||||
|
StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
28
ProjectBomber/ProjectBomber/PlanesCollectionInfo.cs
Normal file
28
ProjectBomber/ProjectBomber/PlanesCollectionInfo.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
internal class PlanesCollectionInfo : IEquatable<PlanesCollectionInfo>
|
||||||
|
{
|
||||||
|
public string Name { get; private set; }
|
||||||
|
public string Description { get; private set; }
|
||||||
|
public PlanesCollectionInfo(string name, string description)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
public bool Equals(PlanesCollectionInfo other)
|
||||||
|
{
|
||||||
|
return Name == other.Name;
|
||||||
|
/* throw new NotImplementedException();*/
|
||||||
|
}
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return this.Name.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,11 +21,11 @@ namespace ProjectBomber.Generics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна прорисовки
|
/// Ширина окна прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _pictureWidth;
|
private readonly int pictureWidth;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота окна прорисовки
|
/// Высота окна прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _pictureHeight;
|
private readonly int pictureHeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Размер занимаемого объектом места (ширина)
|
/// Размер занимаемого объектом места (ширина)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,25 +47,33 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
int width = picWidth / _placeSizeWidth;
|
int width = picWidth / _placeSizeWidth;
|
||||||
int height = picHeight / _placeSizeHeight;
|
int height = picHeight / _placeSizeHeight;
|
||||||
_pictureWidth = picWidth;
|
pictureWidth = picWidth;
|
||||||
_pictureHeight = picHeight;
|
pictureHeight = picHeight;
|
||||||
_collection = new SetGeneric<T>(width * height);
|
_collection = new SetGeneric<T>(width * height);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Сортировка
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void Sort(IComparer<T> comparer) => _collection.SortSet(comparer);
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объектов коллекции
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<T> GetPlanes => _collection.GetPlanes();
|
||||||
|
/// <summary>
|
||||||
/// Перегрузка оператора сложения
|
/// Перегрузка оператора сложения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="collect"></param>
|
/// <param name="collect"></param>
|
||||||
/// <param name="obj"></param>
|
/// <param name="obj"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool operator +(PlanesGenericCollection<T, U> collect, T
|
public static int operator +(PlanesGenericCollection<T, U> collect, T
|
||||||
obj)
|
obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
collect?._collection.Insert(obj);
|
return collect?._collection.Insert(obj, new DrawiningPlaneEqutables()) ?? -1;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перегрузка оператора вычитания
|
/// Перегрузка оператора вычитания
|
||||||
@@ -78,7 +86,7 @@ namespace ProjectBomber.Generics
|
|||||||
T obj = collect._collection[pos];
|
T obj = collect._collection[pos];
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
collect._collection.Remove(pos);
|
collect?._collection.Remove(pos);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@@ -97,7 +105,7 @@ namespace ProjectBomber.Generics
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Bitmap ShowPlanes()
|
public Bitmap ShowPlanes()
|
||||||
{
|
{
|
||||||
Bitmap bmp = new Bitmap(_pictureWidth, _pictureHeight);
|
Bitmap bmp = new Bitmap(pictureWidth, pictureHeight);
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
DrawBackground(gr);
|
DrawBackground(gr);
|
||||||
DrawObjects(gr);
|
DrawObjects(gr);
|
||||||
@@ -110,9 +118,8 @@ namespace ProjectBomber.Generics
|
|||||||
private void DrawBackground(Graphics g)
|
private void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
Pen pen = new Pen(Color.Black, 3);
|
Pen pen = new Pen(Color.Black, 3);
|
||||||
int numColumns = _pictureWidth / _placeSizeWidth;
|
int numColumns = pictureWidth / _placeSizeWidth;
|
||||||
int numRows = _pictureHeight / _placeSizeHeight;
|
int numRows = pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
for (int i = 0; i <= numColumns; i++)
|
for (int i = 0; i <= numColumns; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j <= numRows; ++j)
|
for (int j = 0; j <= numRows; ++j)
|
||||||
@@ -122,7 +129,6 @@ namespace ProjectBomber.Generics
|
|||||||
int y = j * _placeSizeHeight;
|
int y = j * _placeSizeHeight;
|
||||||
g.DrawLine(pen, x, y, x + _placeSizeWidth / 2, y);
|
g.DrawLine(pen, x, y, x + _placeSizeWidth / 2, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, numRows * _placeSizeHeight);
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, numRows * _placeSizeHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +138,7 @@ namespace ProjectBomber.Generics
|
|||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
int numColumns = _pictureWidth / _placeSizeWidth;
|
int numColumns = pictureWidth / _placeSizeWidth;
|
||||||
int column = numColumns - 1;
|
int column = numColumns - 1;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
foreach (var plane in _collection.GetPlanes())
|
foreach (var plane in _collection.GetPlanes())
|
||||||
@@ -142,6 +148,8 @@ namespace ProjectBomber.Generics
|
|||||||
int yPosition = row * _placeSizeHeight;
|
int yPosition = row * _placeSizeHeight;
|
||||||
if (plane != null)
|
if (plane != null)
|
||||||
{
|
{
|
||||||
|
plane._pictureHeight = pictureHeight;
|
||||||
|
plane._pictureWidth = pictureWidth;
|
||||||
// Перемещение по ячейкам влево, вниз
|
// Перемещение по ячейкам влево, вниз
|
||||||
column--;
|
column--;
|
||||||
if (column < 0)
|
if (column < 0)
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
using ProjectBomber.DrawningObjects;
|
using ProjectBomber.DrawningObjects;
|
||||||
using ProjectBomber.MovementStrategy;
|
using ProjectBomber.MovementStrategy;
|
||||||
|
|
||||||
@@ -16,12 +18,12 @@ namespace ProjectBomber.Generics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Словарь (хранилище)
|
/// Словарь (хранилище)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
readonly Dictionary<string, PlanesGenericCollection<DrawningBomber,
|
readonly Dictionary<PlanesCollectionInfo, PlanesGenericCollection<DrawningBomber,
|
||||||
DrawningObjectBomber>> _planeStorages;
|
DrawningObjectBomber>> _planeStorages;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Возвращение списка названий наборов
|
/// Возвращение списка названий наборов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Keys => _planeStorages.Keys.ToList();
|
public List<PlanesCollectionInfo> Keys => _planeStorages.Keys.ToList();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна отрисовки
|
/// Ширина окна отрисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -37,25 +39,37 @@ namespace ProjectBomber.Generics
|
|||||||
/// <param name="pictureHeight"></param>
|
/// <param name="pictureHeight"></param>
|
||||||
public PlanesGenericStorage(int pictureWidth, int pictureHeight)
|
public PlanesGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
{
|
{
|
||||||
_planeStorages = new Dictionary<string,
|
_planeStorages = new Dictionary<PlanesCollectionInfo,
|
||||||
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>>();
|
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>>();
|
||||||
_pictureWidth = pictureWidth;
|
_pictureWidth = pictureWidth;
|
||||||
_pictureHeight = pictureHeight;
|
_pictureHeight = pictureHeight;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Разделитель для записи ключа и значения элемента словаря
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForKeyValue = '|';
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записей коллекции данных в файл
|
||||||
|
/// </summary>
|
||||||
|
private readonly char _separatorRecords = ';';
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи информации по объекту в файл
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForObject = ':';
|
||||||
|
/// <summary>
|
||||||
/// Добавление набора
|
/// Добавление набора
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">Название набора</param>
|
/// <param name="name">Название набора</param>
|
||||||
public void AddSet(string name)
|
public void AddSet(string name)
|
||||||
{
|
{
|
||||||
// Создаем новый набор и добавляем его в словарь
|
if (_planeStorages.ContainsKey(new PlanesCollectionInfo(name, string.Empty)))
|
||||||
if (!_planeStorages.ContainsKey(name))
|
|
||||||
{
|
{
|
||||||
_planeStorages[name] = new PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight);
|
MessageBox.Show("Словарь уже содержит набор с таким названием", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Набор с таким именем уже существует");
|
_planeStorages.Add(new PlanesCollectionInfo(name, string.Empty), new PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,15 +78,9 @@ namespace ProjectBomber.Generics
|
|||||||
/// <param name="name">Название набора</param>
|
/// <param name="name">Название набора</param>
|
||||||
public void DelSet(string name)
|
public void DelSet(string name)
|
||||||
{
|
{
|
||||||
// Удаляем набор из словаря по имени
|
if (!_planeStorages.ContainsKey(new PlanesCollectionInfo(name, string.Empty)))
|
||||||
if (_planeStorages.ContainsKey(name))
|
return;
|
||||||
{
|
_planeStorages.Remove(new PlanesCollectionInfo(name, string.Empty));
|
||||||
_planeStorages.Remove(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Набор с таким именем не найден.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Доступ к набору
|
/// Доступ к набору
|
||||||
@@ -83,14 +91,97 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_planeStorages.ContainsKey(ind))
|
PlanesCollectionInfo indObj = new PlanesCollectionInfo(ind, string.Empty);
|
||||||
|
if (_planeStorages.ContainsKey(indObj))
|
||||||
|
return _planeStorages[indObj];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение информации по самолетам в хранилище в файл
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Путь и имя файла</param>
|
||||||
|
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||||
|
public void SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (_planeStorages.Count == 0)
|
||||||
|
throw new InvalidOperationException("Невалидная операция: нет данных для сохранения");
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
StringBuilder data = new StringBuilder();
|
||||||
|
foreach (KeyValuePair<PlanesCollectionInfo,
|
||||||
|
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>> record in _planeStorages)
|
||||||
|
{
|
||||||
|
StringBuilder records = new StringBuilder();
|
||||||
|
foreach (DrawningBomber elem in record.Value.GetPlanes)
|
||||||
{
|
{
|
||||||
return _planeStorages[ind];
|
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||||
}
|
}
|
||||||
else
|
data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}");
|
||||||
|
}
|
||||||
|
if (data.Length == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Невалидная операция: нет данных для сохранения");
|
||||||
|
}
|
||||||
|
using (StreamWriter writer = new StreamWriter(filename))
|
||||||
|
{
|
||||||
|
writer.Write($"PlanesStorage{Environment.NewLine}{data}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка информации по самолетам в хранилище из файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Путь и имя файла</param>
|
||||||
|
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||||
|
public void LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
throw new FileNotFoundException("Файл не найден");
|
||||||
|
|
||||||
|
using (StreamReader sr = new StreamReader(filename))
|
||||||
|
{
|
||||||
|
if (sr.ReadLine() != "PlanesStorage")
|
||||||
|
throw new FormatException("Неверный формат данных");
|
||||||
|
|
||||||
|
string str = sr.ReadLine();
|
||||||
|
var strs = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strs == null || strs.Length == 0)
|
||||||
{
|
{
|
||||||
throw new KeyNotFoundException($"Набор с именем '{ind}' не найден.");
|
throw new Exception("Нет данных для загрузки");
|
||||||
}
|
}
|
||||||
|
_planeStorages.Clear();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
string[] record = str.Split(new[] { _separatorForKeyValue }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (record.Length != 2)
|
||||||
|
{
|
||||||
|
str = sr.ReadLine();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>
|
||||||
|
collection = new PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight);
|
||||||
|
string[] set = record[1].Split(new[] { _separatorRecords, }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string elem in set)
|
||||||
|
{
|
||||||
|
DrawningBomber plane = elem?.CreateDrawningPlane(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
|
if (plane != null)
|
||||||
|
{
|
||||||
|
try { _ = collection + plane; }
|
||||||
|
catch (PlaneNotFoundException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
catch (StorageOverflowException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_planeStorages.Add(new PlanesCollectionInfo(record[0], string.Empty), collection);
|
||||||
|
str = sr.ReadLine();
|
||||||
|
} while (str != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
using System;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Serilog;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ProjectBomber
|
namespace ProjectBomber
|
||||||
{
|
{
|
||||||
@@ -16,7 +22,31 @@ namespace ProjectBomber
|
|||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new FormPlaneCollection());
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
using (ServiceProvider serviceProvider =
|
||||||
|
services.BuildServiceProvider())
|
||||||
|
{
|
||||||
|
|
||||||
|
Application.Run(serviceProvider.GetRequiredService<FormPlaneCollection>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
{
|
||||||
|
// Установка текущего рабочего каталога
|
||||||
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
|
||||||
|
// Использование Path.Combine для формирования абсолютного пути к appsettings.json
|
||||||
|
var pathToAppsettings = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json");
|
||||||
|
services.AddSingleton<FormPlaneCollection>().AddLogging(option =>
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile(path: pathToAppsettings, optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
var logger = new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger();
|
||||||
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
|
option.AddSerilog(logger);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>ProjectBomber</RootNamespace>
|
<RootNamespace>ProjectBomber</RootNamespace>
|
||||||
<AssemblyName>ProjectBomber</AssemblyName>
|
<AssemblyName>ProjectBomber</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
@@ -24,9 +25,9 @@
|
|||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -48,8 +49,109 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2023.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Configuration, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Configuration.8.0.0\lib\net462\Microsoft.Extensions.Configuration.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.8.0.0\lib\net462\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Configuration.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Configuration.Json.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.DependencyModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.8.0.0\lib\net462\Microsoft.Extensions.DependencyModel.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.8.0.0\lib\net462\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.8.0.0\lib\net462\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Logging.8.0.0\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Options, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Options.8.0.0\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.5.2.7\lib\net46\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NLog.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.Extensions.Logging.5.3.5\lib\net461\NLog.Extensions.Logging.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Serilog.3.1.1\lib\net471\Serilog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Serilog.Extensions.Logging, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Serilog.Extensions.Logging.8.0.0\lib\net462\Serilog.Extensions.Logging.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Serilog.Settings.Configuration, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Serilog.Settings.Configuration.8.0.0\lib\net462\Serilog.Settings.Configuration.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Serilog.Sinks.File.5.0.0\lib\net45\Serilog.Sinks.File.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime" />
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Json.8.0.0\lib\net462\System.Text.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -63,11 +165,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AbstractStrategy.cs" />
|
<Compile Include="AbstractStrategy.cs" />
|
||||||
<Compile Include="Direction.cs" />
|
<Compile Include="Direction.cs" />
|
||||||
|
<Compile Include="DrawiningPlaneEqutables.cs" />
|
||||||
<Compile Include="DrawningBomber.cs" />
|
<Compile Include="DrawningBomber.cs" />
|
||||||
<Compile Include="DrawningBomberAdvanced.cs" />
|
<Compile Include="DrawningBomberAdvanced.cs" />
|
||||||
<Compile Include="DrawningObjectBomber.cs" />
|
<Compile Include="DrawningObjectBomber.cs" />
|
||||||
<Compile Include="EntityBomber.cs" />
|
<Compile Include="EntityBomber.cs" />
|
||||||
<Compile Include="EntityBomberAdvanced.cs" />
|
<Compile Include="EntityBomberAdvanced.cs" />
|
||||||
|
<Compile Include="ExtentionDrawningPlane.cs" />
|
||||||
<Compile Include="Form1.cs">
|
<Compile Include="Form1.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -80,40 +184,39 @@
|
|||||||
<Compile Include="FormPlaneCollection.Designer.cs">
|
<Compile Include="FormPlaneCollection.Designer.cs">
|
||||||
<DependentUpon>FormPlaneCollection.cs</DependentUpon>
|
<DependentUpon>FormPlaneCollection.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="FormPlaneConfig.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FormPlaneConfig.Designer.cs">
|
||||||
|
<DependentUpon>FormPlaneConfig.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="IMoveableObject.cs" />
|
<Compile Include="IMoveableObject.cs" />
|
||||||
<Compile Include="MoveToBottomRight.cs" />
|
<Compile Include="MoveToBottomRight.cs" />
|
||||||
<Compile Include="MoveToCenter.cs" />
|
<Compile Include="MoveToCenter.cs" />
|
||||||
<Compile Include="ObjectParameters.cs" />
|
<Compile Include="ObjectParameters.cs" />
|
||||||
|
<Compile Include="PlaneCompareByColor.cs" />
|
||||||
|
<Compile Include="PlaneCompareByType.cs" />
|
||||||
|
<Compile Include="PlaneNotFoundException.cs" />
|
||||||
|
<Compile Include="PlanesCollectionInfo.cs" />
|
||||||
<Compile Include="PlanesGenericCollection.cs" />
|
<Compile Include="PlanesGenericCollection.cs" />
|
||||||
<Compile Include="PlanesGenericStorage.cs" />
|
<Compile Include="PlanesGenericStorage.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SetGeneric.cs" />
|
<Compile Include="SetGeneric.cs" />
|
||||||
<Compile Include="Status.cs" />
|
<Compile Include="Status.cs" />
|
||||||
|
<Compile Include="StorageOverflowException.cs" />
|
||||||
<EmbeddedResource Include="Form1.resx">
|
<EmbeddedResource Include="Form1.resx">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="FormPlaneCollection.resx">
|
<EmbeddedResource Include="FormPlaneCollection.resx">
|
||||||
<DependentUpon>FormPlaneCollection.cs</DependentUpon>
|
<DependentUpon>FormPlaneCollection.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="FormPlaneConfig.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<DependentUpon>FormPlaneConfig.cs</DependentUpon>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<None Include="appsettings.json">
|
||||||
<AutoGen>True</AutoGen>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
</None>
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программным средством.
|
|
||||||
// Версия среды выполнения: 4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
|
|
||||||
// код создан повторно.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectBomber.Properties
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
|
|
||||||
// класс с помощью таких средств, как ResGen или Visual Studio.
|
|
||||||
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
|
|
||||||
// с параметром /str или заново постройте свой VS-проект.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources
|
|
||||||
{
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ((resourceMan == null))
|
|
||||||
{
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectBomber.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Переопределяет свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectBomber.Properties
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
|
||||||
{
|
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
|
||||||
|
|
||||||
public static Settings Default
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return defaultInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
||||||
@@ -10,7 +10,7 @@ namespace ProjectBomber.Generics
|
|||||||
/// Параметризованный набор объектов
|
/// Параметризованный набор объектов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
internal class SetGeneric<T>
|
internal class SetGeneric<T> : NullReferenceException
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,32 +35,21 @@ namespace ProjectBomber.Generics
|
|||||||
_places = new List<T>(count);
|
_places = new List<T>(count);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Сортировка набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void SortSet(IComparer<T> comparer) => _places.Sort(comparer);
|
||||||
|
/// <summary>
|
||||||
/// Добавление объекта в набор
|
/// Добавление объекта в набор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plane">Добавляемый самолет</param>
|
/// <param name="plane">Добавляемый самолет</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Insert(T plane)
|
public int Insert(T plane, IEqualityComparer<T> equal = null)
|
||||||
{
|
{
|
||||||
if (_places.Count == 0)
|
if (_places.Count == _maxCount)
|
||||||
{
|
throw new StorageOverflowException(_maxCount);
|
||||||
_places.Add(plane);
|
Insert(plane, 0, equal);
|
||||||
return true;
|
return 0;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_places.Count < _maxCount)
|
|
||||||
{
|
|
||||||
_places.Add(plane);
|
|
||||||
for (int i = 0; i < _places.Count; i++)
|
|
||||||
{
|
|
||||||
T temp = _places[i];
|
|
||||||
_places[i] = _places[_places.Count - 1];
|
|
||||||
_places[_places.Count - 1] = temp;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
@@ -68,28 +57,18 @@ namespace ProjectBomber.Generics
|
|||||||
/// <param name="plane">Добавляемый самолет</param>
|
/// <param name="plane">Добавляемый самолет</param>
|
||||||
/// <param name="position">Позиция</param>
|
/// <param name="position">Позиция</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Insert(T plane, int position)
|
public bool Insert(T plane, int position, IEqualityComparer<T> equal = null)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _maxCount)
|
if (_places.Count == _maxCount)
|
||||||
{
|
throw new StorageOverflowException(_maxCount);
|
||||||
|
if (!(position >= 0 && position <= Count))
|
||||||
return false;
|
return false;
|
||||||
}
|
if (equal != null)
|
||||||
if (position < _places.Count && _places[position] == null)
|
|
||||||
{
|
{
|
||||||
_places[position] = plane;
|
if (_places.Contains(plane, equal))
|
||||||
}
|
throw new ArgumentException(nameof(plane));
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ищем первую пустую позицию и вставляем туда.
|
|
||||||
for (int i = 0; i < _maxCount; i++)
|
|
||||||
{
|
|
||||||
if (_places[i] == null)
|
|
||||||
{
|
|
||||||
_places[i] = plane;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
_places.Insert(position, plane);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -99,8 +78,12 @@ namespace ProjectBomber.Generics
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Remove(int position)
|
public bool Remove(int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _maxCount)
|
if (position < 0 || position > _maxCount || position >= Count)
|
||||||
return false;
|
throw new PlaneNotFoundException(position);
|
||||||
|
if (_places[position] == null)
|
||||||
|
{
|
||||||
|
throw new PlaneNotFoundException();
|
||||||
|
}
|
||||||
_places[position] = null;
|
_places[position] = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -115,7 +98,7 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
if (position < 0 || position >= _maxCount)
|
if (position < 0 || position >= _maxCount)
|
||||||
return null;
|
return null;
|
||||||
return _places[position];
|
return _places[position] ?? default;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|||||||
21
ProjectBomber/ProjectBomber/StorageOverflowException.cs
Normal file
21
ProjectBomber/ProjectBomber/StorageOverflowException.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace ProjectBomber
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class StorageOverflowException : ApplicationException
|
||||||
|
{
|
||||||
|
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: { count}") { }
|
||||||
|
public StorageOverflowException() : base() { }
|
||||||
|
public StorageOverflowException(string message) : base(message) { }
|
||||||
|
public StorageOverflowException(string message, Exception exception)
|
||||||
|
: base(message, exception) { }
|
||||||
|
protected StorageOverflowException(SerializationInfo info,
|
||||||
|
StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
ProjectBomber/ProjectBomber/appsettings.json
Normal file
20
ProjectBomber/ProjectBomber/appsettings.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Information",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "Logs/log_.log",
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "ProjectBomber"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user