lab_6
This commit is contained in:
parent
34e4d490c0
commit
f33c17eade
11
AirFighter/AirFighter/AirFighterDelegate.cs
Normal file
11
AirFighter/AirFighter/AirFighterDelegate.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AirFighter.DrawningObjects;
|
||||||
|
|
||||||
|
namespace AirFighter
|
||||||
|
{
|
||||||
|
public delegate void AirFighterDelegate(DrawningAirFighter fighter);
|
||||||
|
}
|
@ -10,6 +10,8 @@ namespace AirFighter.Generics
|
|||||||
where T : DrawningAirFighter
|
where T : DrawningAirFighter
|
||||||
where U : IMoveableObject
|
where U : IMoveableObject
|
||||||
{
|
{
|
||||||
|
public IEnumerable<T?> GetAirFighter => _collection.GetAirFighter();
|
||||||
|
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
|
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
|
@ -3,53 +3,138 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using AirFighter.Drawnings;
|
|
||||||
using AirFighter.MovementStrategy;
|
|
||||||
using AirFighter.DrawningObjects;
|
using AirFighter.DrawningObjects;
|
||||||
|
using AirFighter.MovementStrategy;
|
||||||
|
using AirFighter.Generics;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace AirFighter.Generics
|
namespace AirFighter.Generics
|
||||||
{
|
{
|
||||||
internal class AirFighterGenericStorage
|
internal class AirFighterGenericStorage
|
||||||
{
|
{
|
||||||
readonly Dictionary<string, AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>> _AirFighterStorages;
|
readonly Dictionary<string, AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>> _fighterStorages;
|
||||||
public List<string> Keys => _AirFighterStorages.Keys.ToList();
|
|
||||||
|
public List<string> Keys => _fighterStorages.Keys.ToList();
|
||||||
|
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
|
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
public AirFighterGenericStorage(int pictureWidth, int pictureHeight)
|
public AirFighterGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
{
|
{
|
||||||
_AirFighterStorages = new Dictionary<string, AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>>();
|
_fighterStorages = new Dictionary<string, AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>>();
|
||||||
_pictureWidth = pictureWidth;
|
_pictureWidth = pictureWidth;
|
||||||
_pictureHeight = pictureHeight;
|
_pictureHeight = pictureHeight;
|
||||||
}
|
}
|
||||||
public void AddSet(string name)
|
public void AddSet(string name)
|
||||||
{
|
{
|
||||||
if (!_AirFighterStorages.ContainsKey(name))
|
if (_fighterStorages.ContainsKey(name)) return;
|
||||||
{
|
_fighterStorages[name] = new AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>(_pictureWidth, _pictureHeight);
|
||||||
var fighterCollection = new AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>(_pictureWidth, _pictureHeight);
|
|
||||||
_AirFighterStorages.Add(name, fighterCollection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DelSet(string name)
|
public void DelSet(string name)
|
||||||
{
|
{
|
||||||
if (_AirFighterStorages.ContainsKey(name))
|
if (!_fighterStorages.ContainsKey(name)) return;
|
||||||
{
|
_fighterStorages.Remove(name);
|
||||||
_AirFighterStorages.Remove(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>? this[string ind]
|
|
||||||
|
public AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>?
|
||||||
|
this[string ind]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_AirFighterStorages.ContainsKey(ind))
|
if (_fighterStorages.ContainsKey(ind)) return _fighterStorages[ind];
|
||||||
{
|
|
||||||
return _AirFighterStorages[ind];
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly char _separatorForKeyValue = '|';
|
||||||
|
|
||||||
|
private readonly char _separatorRecords = ';';
|
||||||
|
|
||||||
|
private static readonly char _separatorForObject = ':';
|
||||||
|
public bool SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
StringBuilder data = new();
|
||||||
|
foreach (KeyValuePair<string, AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter>> record in _fighterStorages)
|
||||||
|
{
|
||||||
|
StringBuilder records = new();
|
||||||
|
foreach (DrawningAirFighter? elem in record.Value.GetAirFighter)
|
||||||
|
{
|
||||||
|
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||||
|
}
|
||||||
|
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
||||||
|
}
|
||||||
|
if (data.Length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
using StreamWriter fs = new StreamWriter(filename);
|
||||||
|
{
|
||||||
|
fs.WriteLine($"AirFighterStorages{Environment.NewLine}");
|
||||||
|
fs.WriteLine(data);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (StreamReader fs = File.OpenText(filename))
|
||||||
|
{
|
||||||
|
|
||||||
|
string str = fs.ReadLine();
|
||||||
|
|
||||||
|
if (str == null || str.Length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!str.StartsWith("AirFighterStorages"))
|
||||||
|
{
|
||||||
|
//если нет такой записи, то это не те данные
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_fighterStorages.Clear();
|
||||||
|
string strs = "";
|
||||||
|
|
||||||
|
|
||||||
|
while ((strs = fs.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strs == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (record.Length != 2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AirFighterGenericCollection<DrawningAirFighter, DrawningObjectAirFighter> collection = new(_pictureWidth, _pictureHeight);
|
||||||
|
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string elem in set)
|
||||||
|
{
|
||||||
|
DrawningAirFighter? fighter = elem?.CreateDrawningAirFighter(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
|
if (fighter != null)
|
||||||
|
{
|
||||||
|
if ((collection + fighter) == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_fighterStorages.Add(record[0], collection);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
49
AirFighter/AirFighter/ExtentionAirFighter.cs
Normal file
49
AirFighter/AirFighter/ExtentionAirFighter.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AirFighter.Entities;
|
||||||
|
|
||||||
|
namespace AirFighter.DrawningObjects
|
||||||
|
{
|
||||||
|
public static class ExtentionDrawningAirFighter
|
||||||
|
{
|
||||||
|
public static DrawningAirFighter? CreateDrawningAirFighter(this string info, char separatorForObject, int width, int height)
|
||||||
|
{
|
||||||
|
string[] strs = info.Split(separatorForObject);
|
||||||
|
if (strs.Length == 3)
|
||||||
|
{
|
||||||
|
return new DrawningAirFighter(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||||
|
}
|
||||||
|
if (strs.Length == 6)
|
||||||
|
{
|
||||||
|
return new DrawningAirFighterMilitary(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]),
|
||||||
|
Color.FromName(strs[2]),
|
||||||
|
Color.FromName(strs[3]),
|
||||||
|
Convert.ToBoolean(strs[4]),
|
||||||
|
Convert.ToBoolean(strs[5]), width, height);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static string GetDataForSave(this DrawningAirFighter drawningAirFighter,
|
||||||
|
char separatorForObject)
|
||||||
|
{
|
||||||
|
var fighter = drawningAirFighter.EntityAirFighter;
|
||||||
|
if (fighter == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
var str =
|
||||||
|
$"{fighter.Speed}{separatorForObject}{fighter.Weight}{separatorForObject}{fighter.BodyColor.Name}";
|
||||||
|
if (fighter is not EntityAirFighterMilitary fighterMilitary)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
$"{str}{separatorForObject}{fighterMilitary.AdditionalColor.Name}{separatorForObject}{fighterMilitary.Wing}{separatorForObject}{fighterMilitary.Rocket}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -39,9 +39,16 @@
|
|||||||
buttonRefreshCollection = new Button();
|
buttonRefreshCollection = new Button();
|
||||||
buttonAddFighter = new Button();
|
buttonAddFighter = new Button();
|
||||||
pictureBoxCollection = new PictureBox();
|
pictureBoxCollection = new PictureBox();
|
||||||
|
menuStrip1 = new MenuStrip();
|
||||||
|
fileToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
SaveToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
LoadToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
openFileDialog1 = new OpenFileDialog();
|
||||||
|
saveFileDialog1 = new SaveFileDialog();
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
groupBox2.SuspendLayout();
|
groupBox2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||||
|
menuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
@ -149,29 +156,73 @@
|
|||||||
//
|
//
|
||||||
// pictureBoxCollection
|
// pictureBoxCollection
|
||||||
//
|
//
|
||||||
pictureBoxCollection.Location = new Point(0, 0);
|
pictureBoxCollection.Location = new Point(0, 27);
|
||||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||||
pictureBoxCollection.Size = new Size(734, 448);
|
pictureBoxCollection.Size = new Size(734, 421);
|
||||||
pictureBoxCollection.SizeMode = PictureBoxSizeMode.Zoom;
|
pictureBoxCollection.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
pictureBoxCollection.TabIndex = 1;
|
pictureBoxCollection.TabIndex = 1;
|
||||||
pictureBoxCollection.TabStop = false;
|
pictureBoxCollection.TabStop = false;
|
||||||
pictureBoxCollection.Click += ButtonAddAirFighter_Click;
|
pictureBoxCollection.Click += ButtonAddAirFighter_Click;
|
||||||
//
|
//
|
||||||
// FormFighterCollection
|
// menuStrip1
|
||||||
|
//
|
||||||
|
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
|
||||||
|
menuStrip1.Location = new Point(0, 0);
|
||||||
|
menuStrip1.Name = "menuStrip1";
|
||||||
|
menuStrip1.Size = new Size(953, 24);
|
||||||
|
menuStrip1.TabIndex = 2;
|
||||||
|
menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// fileToolStripMenuItem
|
||||||
|
//
|
||||||
|
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem });
|
||||||
|
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
|
fileToolStripMenuItem.Size = new Size(48, 20);
|
||||||
|
fileToolStripMenuItem.Text = "Файл";
|
||||||
|
//
|
||||||
|
// SaveToolStripMenuItem
|
||||||
|
//
|
||||||
|
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||||
|
SaveToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
SaveToolStripMenuItem.Text = "Сохранить";
|
||||||
|
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// LoadToolStripMenuItem
|
||||||
|
//
|
||||||
|
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||||
|
LoadToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
LoadToolStripMenuItem.Text = "Загрузить";
|
||||||
|
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// openFileDialog1
|
||||||
|
//
|
||||||
|
openFileDialog1.FileName = "openFileDialog1";
|
||||||
|
openFileDialog1.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog1
|
||||||
|
//
|
||||||
|
saveFileDialog1.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// FormAirFighterCollection
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(953, 448);
|
ClientSize = new Size(953, 448);
|
||||||
Controls.Add(pictureBoxCollection);
|
Controls.Add(pictureBoxCollection);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBox1);
|
||||||
Name = "FormFighterCollection";
|
Controls.Add(menuStrip1);
|
||||||
|
MainMenuStrip = menuStrip1;
|
||||||
|
Name = "FormAirFighterCollection";
|
||||||
Text = "Набор истребителя";
|
Text = "Набор истребителя";
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
groupBox1.PerformLayout();
|
groupBox1.PerformLayout();
|
||||||
groupBox2.ResumeLayout(false);
|
groupBox2.ResumeLayout(false);
|
||||||
groupBox2.PerformLayout();
|
groupBox2.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -187,5 +238,11 @@
|
|||||||
private Button buttonDelObject;
|
private Button buttonDelObject;
|
||||||
private ListBox listBoxStorage;
|
private ListBox listBoxStorage;
|
||||||
private Button buttonAddObject;
|
private Button buttonAddObject;
|
||||||
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem fileToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
|
private OpenFileDialog openFileDialog1;
|
||||||
|
private SaveFileDialog saveFileDialog1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ using AirFighter.MovementStrategy;
|
|||||||
|
|
||||||
|
|
||||||
namespace AirFighter
|
namespace AirFighter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Форма для работы с набором объектов класса DrawningAirFighter
|
/// Форма для работы с набором объектов класса DrawningAirFighter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -126,10 +126,6 @@ namespace AirFighter
|
|||||||
}
|
}
|
||||||
private void ButtonAddAirFighter_Click(object sender, EventArgs e)
|
private void ButtonAddAirFighter_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var formAirFighterConfig = new FormAirFighterConfig();
|
var formAirFighterConfig = new FormAirFighterConfig();
|
||||||
formAirFighterConfig.AddEvent(addAirFighter);
|
formAirFighterConfig.AddEvent(addAirFighter);
|
||||||
formAirFighterConfig.Show();
|
formAirFighterConfig.Show();
|
||||||
@ -190,7 +186,40 @@ namespace AirFighter
|
|||||||
pictureBoxCollection.Image = obj.ShowAirFighter();
|
pictureBoxCollection.Image = obj.ShowAirFighter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_storage.SaveData(saveFileDialog1.FileName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Сохранение прошло успешно",
|
||||||
|
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не сохранилось", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_storage.LoadData(openFileDialog1.FileName))
|
||||||
|
{
|
||||||
|
ReloadObjects();
|
||||||
|
MessageBox.Show("Загрузка прошла успешно",
|
||||||
|
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не загрузилось", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,4 +117,13 @@
|
|||||||
<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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>132, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>272, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -119,7 +119,7 @@
|
|||||||
//
|
//
|
||||||
// panelPurple
|
// panelPurple
|
||||||
//
|
//
|
||||||
panelPurple.BackColor = Color.FromArgb(192, 0, 192);
|
panelPurple.BackColor = Color.Purple;
|
||||||
panelPurple.Location = new Point(139, 63);
|
panelPurple.Location = new Point(139, 63);
|
||||||
panelPurple.Name = "panelPurple";
|
panelPurple.Name = "panelPurple";
|
||||||
panelPurple.Size = new Size(35, 30);
|
panelPurple.Size = new Size(35, 30);
|
||||||
@ -164,7 +164,7 @@
|
|||||||
//
|
//
|
||||||
// panelGreen
|
// panelGreen
|
||||||
//
|
//
|
||||||
panelGreen.BackColor = Color.FromArgb(0, 192, 0);
|
panelGreen.BackColor = Color.Green;
|
||||||
panelGreen.Location = new Point(57, 22);
|
panelGreen.Location = new Point(57, 22);
|
||||||
panelGreen.Name = "panelGreen";
|
panelGreen.Name = "panelGreen";
|
||||||
panelGreen.Size = new Size(35, 30);
|
panelGreen.Size = new Size(35, 30);
|
||||||
@ -311,7 +311,7 @@
|
|||||||
buttonCancel.Text = "Отмена";
|
buttonCancel.Text = "Отмена";
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// FormFighterConfig
|
// FormAirFighterConfig
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
@ -320,9 +320,8 @@
|
|||||||
Controls.Add(ButtonOk);
|
Controls.Add(ButtonOk);
|
||||||
Controls.Add(panelColor);
|
Controls.Add(panelColor);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBox1);
|
||||||
Name = "FormFighterConfig";
|
Name = "FormAirFighterConfig";
|
||||||
Text = "FormFighterConfig";
|
Text = "FormFighterConfig";
|
||||||
|
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
groupBox1.PerformLayout();
|
groupBox1.PerformLayout();
|
||||||
groupBox2.ResumeLayout(false);
|
groupBox2.ResumeLayout(false);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace AirFighter.Generics
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace AirFighter.Generics
|
||||||
{
|
{
|
||||||
internal class SetGeneric<T>
|
internal class SetGeneric<T>
|
||||||
where T : class
|
where T : class
|
||||||
@ -18,8 +20,7 @@
|
|||||||
}
|
}
|
||||||
public int Insert(T fighter, int position)
|
public int Insert(T fighter, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position > Count || Count >= _maxCount)
|
if (position < 0 || position >= _maxCount) return -1;
|
||||||
return -1;
|
|
||||||
_places.Insert(position, fighter);
|
_places.Insert(position, fighter);
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user