SemesterFirstLabEighthBomberBase
This commit is contained in:
parent
4f2b31bf11
commit
0a0ac93219
@ -1,37 +1,37 @@
|
|||||||
<?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.8"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
<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"/>
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
<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"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
<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"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
|
<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"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
@ -52,7 +52,7 @@ namespace ProjectBomber.Generics
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public int GetHashCode([DisallowNull] DrawningBomber obj)
|
public int GetHashCode(DrawningBomber obj)
|
||||||
{
|
{
|
||||||
return obj.GetHashCode();
|
return obj.GetHashCode();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
@ -47,12 +49,13 @@
|
|||||||
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBoxSet.SuspendLayout();
|
this.groupBoxSet.SuspendLayout();
|
||||||
this.menuStrip.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// 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);
|
||||||
@ -66,15 +69,35 @@
|
|||||||
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 = "Наборы";
|
||||||
@ -117,9 +140,9 @@
|
|||||||
//
|
//
|
||||||
// ButtonRefreshCollection
|
// ButtonRefreshCollection
|
||||||
//
|
//
|
||||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(20, 492);
|
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;
|
||||||
@ -137,16 +160,16 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxNumber
|
// maskedTextBoxNumber
|
||||||
//
|
//
|
||||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(18, 351);
|
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, 305);
|
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;
|
||||||
@ -155,8 +178,6 @@
|
|||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
this.menuStrip.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.menuStrip.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.fileToolStripMenuItem});
|
|
||||||
this.menuStrip.Location = new System.Drawing.Point(3, 536);
|
this.menuStrip.Location = new System.Drawing.Point(3, 536);
|
||||||
this.menuStrip.Name = "menuStrip";
|
this.menuStrip.Name = "menuStrip";
|
||||||
this.menuStrip.Size = new System.Drawing.Size(204, 24);
|
this.menuStrip.Size = new System.Drawing.Size(204, 24);
|
||||||
@ -175,23 +196,23 @@
|
|||||||
// saveToolStripMenuItem
|
// saveToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.saveToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
||||||
this.saveToolStripMenuItem.Text = "Save";
|
this.saveToolStripMenuItem.Text = "Save";
|
||||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// loadToolStripMenuItem
|
// loadToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||||
this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.loadToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
|
||||||
this.loadToolStripMenuItem.Text = "Load";
|
this.loadToolStripMenuItem.Text = "Load";
|
||||||
this.loadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
this.loadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// pictureBoxCollection
|
// pictureBoxCollection
|
||||||
//
|
//
|
||||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 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, 565);
|
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
|
// openFileDialog
|
||||||
@ -217,8 +238,6 @@
|
|||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
this.groupBoxSet.ResumeLayout(false);
|
this.groupBoxSet.ResumeLayout(false);
|
||||||
this.groupBoxSet.PerformLayout();
|
this.groupBoxSet.PerformLayout();
|
||||||
this.menuStrip.ResumeLayout(false);
|
|
||||||
this.menuStrip.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@ -243,5 +262,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
|
||||||
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
||||||
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
||||||
|
private System.Windows.Forms.Button ButtonSortByColor;
|
||||||
|
private System.Windows.Forms.Button ButtonSortByType;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,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))
|
||||||
@ -268,5 +268,25 @@ _storage[ListBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowPlanes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,9 @@
|
|||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</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">
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>132, 17</value>
|
<value>132, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -8,8 +8,38 @@ using ProjectBomber.DrawningObjects;
|
|||||||
|
|
||||||
namespace ProjectBomber
|
namespace ProjectBomber
|
||||||
{
|
{
|
||||||
internal class PlaneCompareByColor : IComparer<DrawningCar?>
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -52,6 +52,11 @@ namespace ProjectBomber.Generics
|
|||||||
_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>
|
/// </summary>
|
||||||
public IEnumerable<T> GetPlanes => _collection.GetPlanes();
|
public IEnumerable<T> GetPlanes => _collection.GetPlanes();
|
||||||
@ -68,7 +73,7 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return collect?._collection.Insert(obj) ?? -1;
|
return collect?._collection.Insert(obj, new DrawiningPlaneEqutables()) ?? -1;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перегрузка оператора вычитания
|
/// Перегрузка оператора вычитания
|
||||||
|
@ -4,6 +4,7 @@ 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;
|
||||||
|
|
||||||
@ -17,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>
|
||||||
@ -38,7 +39,7 @@ 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;
|
||||||
@ -61,14 +62,14 @@ namespace ProjectBomber.Generics
|
|||||||
/// <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>
|
||||||
@ -77,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>
|
||||||
/// Доступ к набору
|
/// Доступ к набору
|
||||||
@ -96,14 +91,10 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_planeStorages.ContainsKey(ind))
|
PlanesCollectionInfo indObj = new PlanesCollectionInfo(ind, string.Empty);
|
||||||
{
|
if (_planeStorages.ContainsKey(indObj))
|
||||||
return _planeStorages[ind];
|
return _planeStorages[indObj];
|
||||||
}
|
return null;
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new KeyNotFoundException($"Набор с именем '{ind}' не найден.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -120,7 +111,7 @@ namespace ProjectBomber.Generics
|
|||||||
File.Delete(filename);
|
File.Delete(filename);
|
||||||
}
|
}
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
foreach (KeyValuePair<string,
|
foreach (KeyValuePair<PlanesCollectionInfo,
|
||||||
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>> record in _planeStorages)
|
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>> record in _planeStorages)
|
||||||
{
|
{
|
||||||
StringBuilder records = new StringBuilder();
|
StringBuilder records = new StringBuilder();
|
||||||
@ -128,11 +119,11 @@ namespace ProjectBomber.Generics
|
|||||||
{
|
{
|
||||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||||
}
|
}
|
||||||
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}");
|
||||||
}
|
}
|
||||||
if (data.Length == 0)
|
if (data.Length == 0)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Невалидная операция, нет данных для сохранения");
|
throw new Exception("Невалидная операция: нет данных для сохранения");
|
||||||
}
|
}
|
||||||
using (StreamWriter writer = new StreamWriter(filename))
|
using (StreamWriter writer = new StreamWriter(filename))
|
||||||
{
|
{
|
||||||
@ -147,40 +138,34 @@ namespace ProjectBomber.Generics
|
|||||||
public void LoadData(string filename)
|
public void LoadData(string filename)
|
||||||
{
|
{
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
|
||||||
throw new FileNotFoundException("Файл не найден");
|
throw new FileNotFoundException("Файл не найден");
|
||||||
}
|
|
||||||
using (StreamReader reader = new StreamReader(filename))
|
using (StreamReader sr = new StreamReader(filename))
|
||||||
{
|
{
|
||||||
string cheker = reader.ReadLine();
|
if (sr.ReadLine() != "PlanesStorage")
|
||||||
if (cheker == null || cheker.Length == 0)
|
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 NullReferenceException("Нет данных для загрузки");
|
throw new Exception("Нет данных для загрузки");
|
||||||
}
|
|
||||||
if (!cheker.StartsWith("PlanesStorage"))
|
|
||||||
{
|
|
||||||
//если нет такой записи, то это не те данные
|
|
||||||
throw new InvalidDataException("Неверный формат данных");
|
|
||||||
}
|
}
|
||||||
_planeStorages.Clear();
|
_planeStorages.Clear();
|
||||||
string strs;
|
do
|
||||||
bool firstinit = true;
|
|
||||||
while ((strs = reader.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
if (strs == null && firstinit)
|
string[] record = str.Split(new[] { _separatorForKeyValue }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (record.Length != 2)
|
||||||
{
|
{
|
||||||
throw new Exception("Нет данных для загрузки");
|
str = sr.ReadLine();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (strs == null)
|
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>
|
||||||
|
collection = new PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight);
|
||||||
|
string[] set = record[1].Split(new[] { _separatorRecords, }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string elem in set)
|
||||||
{
|
{
|
||||||
break;
|
DrawningBomber plane = elem?.CreateDrawningPlane(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
}
|
|
||||||
firstinit = false;
|
|
||||||
string name = strs.Split(_separatorForKeyValue)[0];
|
|
||||||
PlanesGenericCollection<DrawningBomber, DrawningObjectBomber> collection = new PlanesGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight);
|
|
||||||
foreach (string data in strs.Split(_separatorForKeyValue)[1].Split(_separatorRecords))
|
|
||||||
{
|
|
||||||
DrawningBomber plane = data?.CreateDrawningPlane(_separatorForObject, _pictureWidth, _pictureHeight);
|
|
||||||
if (plane != null)
|
if (plane != null)
|
||||||
{
|
{
|
||||||
try { _ = collection + plane; }
|
try { _ = collection + plane; }
|
||||||
@ -194,8 +179,9 @@ namespace ProjectBomber.Generics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_planeStorages.Add(name, collection);
|
_planeStorages.Add(new PlanesCollectionInfo(record[0], string.Empty), collection);
|
||||||
}
|
str = sr.ReadLine();
|
||||||
|
} while (str != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -49,6 +49,9 @@
|
|||||||
<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">
|
<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>
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -194,6 +197,7 @@
|
|||||||
<Compile Include="PlaneCompareByColor.cs" />
|
<Compile Include="PlaneCompareByColor.cs" />
|
||||||
<Compile Include="PlaneCompareByType.cs" />
|
<Compile Include="PlaneCompareByType.cs" />
|
||||||
<Compile Include="PlaneNotFoundException.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" />
|
||||||
@ -210,29 +214,9 @@
|
|||||||
<EmbeddedResource Include="FormPlaneConfig.resx">
|
<EmbeddedResource Include="FormPlaneConfig.resx">
|
||||||
<DependentUpon>FormPlaneConfig.cs</DependentUpon>
|
<DependentUpon>FormPlaneConfig.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Compile>
|
|
||||||
<None Include="appsettings.json">
|
<None Include="appsettings.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</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,63 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectBomber.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 (object.ReferenceEquals(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,117 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: 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:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<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:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectBomber.Properties {
|
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.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>
|
|
@ -35,17 +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, IEqualityComparer<T> equal = null)
|
public int Insert(T plane, IEqualityComparer<T> equal = null)
|
||||||
{
|
{
|
||||||
if (_places.Count == _maxCount)
|
if (_places.Count == _maxCount)
|
||||||
throw new StorageOverflowException(_maxCount);
|
throw new StorageOverflowException(_maxCount);
|
||||||
Insert(plane, 0);
|
|
||||||
Insert(plane, 0, equal);
|
Insert(plane, 0, equal);
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Configuration" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Configuration.Abstractions" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Configuration.Binder" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Configuration.Json" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.DependencyInjection" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.DependencyModel" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.FileProviders.Physical" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.FileSystemGlobbing" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Logging" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Options" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Microsoft.Extensions.Primitives" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="NLog" version="5.2.7" targetFramework="net472" />
|
|
||||||
<package id="NLog.Extensions.Logging" version="5.3.5" targetFramework="net472" />
|
|
||||||
<package id="Serilog" version="3.1.1" targetFramework="net472" />
|
|
||||||
<package id="Serilog.Extensions.Logging" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Serilog.Settings.Configuration" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="Serilog.Sinks.File" version="5.0.0" targetFramework="net472" />
|
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
|
||||||
<package id="System.Diagnostics.DiagnosticSource" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
|
||||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="System.Text.Json" version="8.0.0" targetFramework="net472" />
|
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
|
||||||
</packages>
|
|
Loading…
Reference in New Issue
Block a user