Compare commits
No commits in common. "FourthLab" and "master" have entirely different histories.
@ -8,19 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,52 +0,0 @@
|
|||||||
using AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public abstract class AbstractCompany
|
|
||||||
{
|
|
||||||
protected const int _placeSizeWidth = 300;
|
|
||||||
protected const int _placeSizeHeight = 150;
|
|
||||||
protected readonly int _pictureWidth;
|
|
||||||
protected readonly int _pictureHeight;
|
|
||||||
private int GetMaxCount => (_pictureWidth / _placeSizeWidth) * (_pictureHeight / _placeSizeHeight);
|
|
||||||
protected ICollectionGenericObjects<DrawingSimpleAircraftCarrier>? _collection = null;
|
|
||||||
public AbstractCompany(int pictureWidth, int pictureHeight, ICollectionGenericObjects<DrawingSimpleAircraftCarrier> collection) {
|
|
||||||
_pictureWidth = pictureWidth;
|
|
||||||
_pictureHeight = pictureHeight;
|
|
||||||
_collection = collection;
|
|
||||||
_collection.SetMaxCount = GetMaxCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator +(AbstractCompany company, DrawingSimpleAircraftCarrier aircraftCarrier)
|
|
||||||
{
|
|
||||||
return company._collection?.Insert(aircraftCarrier) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator -(AbstractCompany company, int pos)
|
|
||||||
{
|
|
||||||
return company._collection?.Remove(pos) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingSimpleAircraftCarrier? GetRandom()
|
|
||||||
{
|
|
||||||
Random random = new Random();
|
|
||||||
return _collection?.Get(random.Next(GetMaxCount));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bitmap? Show()
|
|
||||||
{
|
|
||||||
Bitmap bitmap = new Bitmap(_pictureWidth, _pictureHeight);
|
|
||||||
Graphics graphics = Graphics.FromImage(bitmap);
|
|
||||||
DrawBackground(graphics);
|
|
||||||
SetObjectPosition();
|
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
|
||||||
{
|
|
||||||
DrawingSimpleAircraftCarrier? obj = _collection?.Get(i);
|
|
||||||
obj?.DrawAircraftCarrier(graphics);
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void DrawBackground(Graphics g);
|
|
||||||
protected abstract void SetObjectPosition();
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public enum CollectionType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Massive,
|
|
||||||
List
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
|
|
||||||
using AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class DocksService : AbstractCompany
|
|
||||||
{
|
|
||||||
public DocksService(
|
|
||||||
int pictureWidth,
|
|
||||||
int pictureHeight,
|
|
||||||
ICollectionGenericObjects<DrawingSimpleAircraftCarrier> collection
|
|
||||||
) :
|
|
||||||
base(pictureWidth, pictureHeight, collection)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void DrawBackground(Graphics g)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++)
|
|
||||||
{
|
|
||||||
Point[] p = {
|
|
||||||
new Point(i*_placeSizeWidth+250,j*_placeSizeHeight),
|
|
||||||
new Point(i*_placeSizeWidth,j*_placeSizeHeight),
|
|
||||||
new Point(i*_placeSizeWidth,j*_placeSizeHeight+_placeSizeHeight),
|
|
||||||
new Point(i*_placeSizeWidth+250,j*_placeSizeHeight+_placeSizeHeight),
|
|
||||||
};
|
|
||||||
Pen pen = new Pen(Color.Black,5);
|
|
||||||
g.DrawLines(pen, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SetObjectPosition()
|
|
||||||
{
|
|
||||||
int maxXPositionCount = _pictureWidth / _placeSizeWidth;
|
|
||||||
int maxYPositionCount = _pictureHeight / _placeSizeHeight;
|
|
||||||
int xpos = 0;
|
|
||||||
int ypos = maxYPositionCount;
|
|
||||||
for (int i = 0; i < _collection?.Count; i++)
|
|
||||||
{
|
|
||||||
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
|
||||||
_collection?.Get(i)?.SetPosition(xpos * _placeSizeWidth + 10, (ypos-1) * _placeSizeHeight + 10);
|
|
||||||
xpos++;
|
|
||||||
if (xpos >= maxXPositionCount)
|
|
||||||
{
|
|
||||||
xpos = 0;
|
|
||||||
ypos--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public interface ICollectionGenericObjects<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
int Count { get; }
|
|
||||||
int SetMaxCount { set; }
|
|
||||||
bool Insert(T obj);
|
|
||||||
bool Insert(T obj, int position);
|
|
||||||
bool Remove(int position);
|
|
||||||
T? Get(int position);
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
private readonly List<T?> _collection;
|
|
||||||
|
|
||||||
private int _maxCount;
|
|
||||||
public int Count => _collection.Count;
|
|
||||||
|
|
||||||
public int SetMaxCount { set { if (value > 0) _maxCount = value; } }
|
|
||||||
|
|
||||||
public ListGenericObjects()
|
|
||||||
{
|
|
||||||
_collection = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
if (!(position >= 0 && position < _collection.Count)) return null;
|
|
||||||
return _collection[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Insert(T obj)
|
|
||||||
{
|
|
||||||
if (_collection.Count >= _maxCount) return false;
|
|
||||||
_collection.Add(obj);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Insert(T obj, int position)
|
|
||||||
{
|
|
||||||
if ((_collection.Count >= _maxCount) || !(position >= 0 && position < _collection.Count)) return false;
|
|
||||||
_collection.Insert(position, obj);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Remove(int position)
|
|
||||||
{
|
|
||||||
if (!(position >= 0 && position < _collection.Count)) return false;
|
|
||||||
_collection.RemoveAt(position);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
private T?[] _collection;
|
|
||||||
public int Count => _collection.Length;
|
|
||||||
|
|
||||||
public int SetMaxCount {
|
|
||||||
set {
|
|
||||||
if (value > 0) {
|
|
||||||
if (_collection.Length > 0)
|
|
||||||
{
|
|
||||||
Array.Resize(ref _collection, value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_collection = new T?[value];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MassiveGenericObjects()
|
|
||||||
{
|
|
||||||
_collection = Array.Empty<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _checkAndInsert(T obj, int pos)
|
|
||||||
{
|
|
||||||
if (_collection[pos] == null)
|
|
||||||
{
|
|
||||||
_collection[pos] = obj;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _checkRange(int pos) => pos >= 0 && pos < Count;
|
|
||||||
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
if (!_checkRange(position)) return null;
|
|
||||||
return _collection[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Insert(T obj)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_checkAndInsert(obj,i)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Insert(T obj, int position)
|
|
||||||
{
|
|
||||||
if (!_checkRange(position)) return false;
|
|
||||||
if (_checkAndInsert(obj, position)) return true;
|
|
||||||
for (int i = position + 1; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_checkAndInsert(obj, i)) return true;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < position; i++)
|
|
||||||
{
|
|
||||||
if (_checkAndInsert(obj, i)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Remove(int position)
|
|
||||||
{
|
|
||||||
if (!_checkRange(position) || _collection[position] == null) return false;
|
|
||||||
_collection[position] = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
using AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class StorageColletion<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
private Dictionary<string, ICollectionGenericObjects<T>> _storage;
|
|
||||||
public List<string> Keys => _storage.Keys.ToList();
|
|
||||||
|
|
||||||
public StorageColletion()
|
|
||||||
{
|
|
||||||
_storage = new Dictionary<string, ICollectionGenericObjects<T>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddCollection(string name, CollectionType type)
|
|
||||||
{
|
|
||||||
if (_storage == null || _storage.ContainsKey(name)) return;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case CollectionType.Massive:
|
|
||||||
_storage.Add(name, new MassiveGenericObjects<T>());
|
|
||||||
break;
|
|
||||||
case CollectionType.List:
|
|
||||||
_storage.Add(name, new ListGenericObjects<T>());
|
|
||||||
break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DelCollection(string? name)
|
|
||||||
{
|
|
||||||
if (name == null) return;
|
|
||||||
if (_storage != null && _storage.ContainsKey(name)) _storage.Remove(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICollectionGenericObjects<T>? this[string name]
|
|
||||||
{
|
|
||||||
get {
|
|
||||||
if (_storage.ContainsKey(name)) return _storage.GetValueOrDefault(name);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace AircraftCarrier.Drawings;
|
|
||||||
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
Unknown = -1,
|
|
||||||
Up = 1,
|
|
||||||
Down = 2,
|
|
||||||
Left = 3,
|
|
||||||
Right = 4,
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using AircraftCarrier.Entities;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
public class DrawingAircraftCarrier : DrawingSimpleAircraftCarrier
|
|
||||||
{
|
|
||||||
public DrawingAircraftCarrier(int speed, double weight, Color primaryColor, Color secondaryColor,
|
|
||||||
bool hasDeck, bool hasСabin) : base()
|
|
||||||
{
|
|
||||||
entityAircraftCarrier = new EntityAircraftCarrier(speed, weight, primaryColor, secondaryColor, hasDeck, hasСabin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawAircraftCarrier(Graphics g)
|
|
||||||
{
|
|
||||||
if (entityAircraftCarrier == null ||
|
|
||||||
!(entityAircraftCarrier is EntityAircraftCarrier entitySimpleAircraftCarrier) ||
|
|
||||||
!_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
base.DrawAircraftCarrier(g);
|
|
||||||
|
|
||||||
Brush brushPC = new SolidBrush(entitySimpleAircraftCarrier.PrimaryColor);
|
|
||||||
Brush brushSC = new SolidBrush(entitySimpleAircraftCarrier.SecondaryColor);
|
|
||||||
|
|
||||||
if (entitySimpleAircraftCarrier.HasDeck)
|
|
||||||
{
|
|
||||||
g.FillRectangle(brushPC, _startPosX.Value + 50, _startPosY.Value + 40, 55, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entitySimpleAircraftCarrier.HasСabin)
|
|
||||||
{
|
|
||||||
g.FillRectangle(brushSC, _startPosX.Value + 105, _startPosY.Value + 25, 30, 50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
using AircraftCarrier.Drawings;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
public class DrawingSimpleAircraftCarrier
|
|
||||||
{
|
|
||||||
public EntitySimpleAircraftCarrier? entityAircraftCarrier { get; protected set; }
|
|
||||||
protected int? _startPosX;
|
|
||||||
protected int? _startPosY;
|
|
||||||
private int? _pictureWidth;
|
|
||||||
private int? _pictureHeight;
|
|
||||||
private readonly int _drawingCarWidth = 250;
|
|
||||||
private readonly int _drawingCarHeight = 100;
|
|
||||||
|
|
||||||
public int? GetPosX => _startPosX;
|
|
||||||
public int? GetPosY => _startPosY;
|
|
||||||
public int GetWidth => _drawingCarWidth;
|
|
||||||
public int GetHeight => _drawingCarHeight;
|
|
||||||
|
|
||||||
|
|
||||||
protected DrawingSimpleAircraftCarrier()
|
|
||||||
{
|
|
||||||
_startPosX = null;
|
|
||||||
_startPosY = null;
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingSimpleAircraftCarrier(int speed, double weight, Color primaryColor) : this()
|
|
||||||
{
|
|
||||||
entityAircraftCarrier = new EntitySimpleAircraftCarrier(speed, weight, primaryColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPictureSize(int width, int height)
|
|
||||||
{
|
|
||||||
if (_drawingCarHeight > height || _drawingCarWidth > width) return;
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) return;
|
|
||||||
|
|
||||||
if (x < 0 || y < 0 ||
|
|
||||||
x + _drawingCarWidth > _pictureWidth ||
|
|
||||||
y + _drawingCarHeight > _pictureHeight) return;
|
|
||||||
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveAircraftCarrier(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (entityAircraftCarrier == null || !_startPosX.HasValue ||
|
|
||||||
!_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY - entityAircraftCarrier.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)entityAircraftCarrier.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY + entityAircraftCarrier.Step + _drawingCarHeight < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)entityAircraftCarrier.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX - entityAircraftCarrier.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)entityAircraftCarrier.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX + entityAircraftCarrier.Step + _drawingCarWidth < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)entityAircraftCarrier.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void DrawAircraftCarrier(Graphics g)
|
|
||||||
{
|
|
||||||
if (entityAircraftCarrier == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Pen pen = new(entityAircraftCarrier.PrimaryColor,5);
|
|
||||||
|
|
||||||
Point[] point = {
|
|
||||||
new Point(_startPosX.Value, _startPosY.Value),
|
|
||||||
new Point(_startPosX.Value + 200, _startPosY.Value),
|
|
||||||
new Point(_startPosX.Value + 250, _startPosY.Value + 50),
|
|
||||||
new Point(_startPosX.Value + 200, _startPosY.Value + 100),
|
|
||||||
new Point(_startPosX.Value, _startPosY.Value + 100),
|
|
||||||
};
|
|
||||||
|
|
||||||
g.DrawPolygon(pen, point);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 175, _startPosY.Value + 35, 30, 30);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace AircraftCarrier.Entities;
|
|
||||||
|
|
||||||
public class EntityAircraftCarrier : EntitySimpleAircraftCarrier
|
|
||||||
{
|
|
||||||
public Color SecondaryColor { get; private set; }
|
|
||||||
public bool HasDeck { get; private set; }
|
|
||||||
public bool HasСabin { get; private set; }
|
|
||||||
|
|
||||||
public EntityAircraftCarrier(int speed, double weight, Color primaryColor, Color secondaryColor,
|
|
||||||
bool hasDeck, bool hasСabin)
|
|
||||||
:base(speed, weight, primaryColor)
|
|
||||||
{
|
|
||||||
SecondaryColor = secondaryColor;
|
|
||||||
HasDeck = hasDeck;
|
|
||||||
HasСabin = hasСabin;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
namespace AircraftCarrier;
|
|
||||||
|
|
||||||
public class EntitySimpleAircraftCarrier
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
public double Step => Speed * 100 / Weight;
|
|
||||||
public Color PrimaryColor { get; private set; }
|
|
||||||
|
|
||||||
public EntitySimpleAircraftCarrier(int speed, double weight, Color primaryColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
PrimaryColor = primaryColor;
|
|
||||||
}
|
|
||||||
}
|
|
39
AircraftCarrier/AircraftCarrier/Form1.Designer.cs
generated
Normal file
39
AircraftCarrier/AircraftCarrier/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace AircraftCarrier
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <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.components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Text = "Form1";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
10
AircraftCarrier/AircraftCarrier/Form1.cs
Normal file
10
AircraftCarrier/AircraftCarrier/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace AircraftCarrier
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
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.Runtime.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
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
@ -1,156 +0,0 @@
|
|||||||
namespace AircraftCarrier
|
|
||||||
{
|
|
||||||
partial class FormAircraftCarrier
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
pictureBoxAircraftCarrier = new PictureBox();
|
|
||||||
buttonLeft = new Button();
|
|
||||||
buttonDown = new Button();
|
|
||||||
buttonRight = new Button();
|
|
||||||
buttonUp = new Button();
|
|
||||||
comboBoxStrategy = new ComboBox();
|
|
||||||
buttonStrategy = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxAircraftCarrier).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxAircraftCarrier
|
|
||||||
//
|
|
||||||
pictureBoxAircraftCarrier.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
pictureBoxAircraftCarrier.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxAircraftCarrier.Location = new Point(0, 0);
|
|
||||||
pictureBoxAircraftCarrier.Name = "pictureBoxAircraftCarrier";
|
|
||||||
pictureBoxAircraftCarrier.Size = new Size(1128, 617);
|
|
||||||
pictureBoxAircraftCarrier.TabIndex = 0;
|
|
||||||
pictureBoxAircraftCarrier.TabStop = false;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.left_arrow;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonLeft.Location = new Point(1005, 565);
|
|
||||||
buttonLeft.Margin = new Padding(0);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(35, 35);
|
|
||||||
buttonLeft.TabIndex = 2;
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImage = Properties.Resources.down_arrow;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDown.Location = new Point(1038, 565);
|
|
||||||
buttonDown.Margin = new Padding(0);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(35, 35);
|
|
||||||
buttonDown.TabIndex = 3;
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImage = Properties.Resources.right_arrow;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonRight.Location = new Point(1071, 565);
|
|
||||||
buttonRight.Margin = new Padding(0);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(35, 35);
|
|
||||||
buttonRight.TabIndex = 4;
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImage = Properties.Resources.up_arrow;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUp.Location = new Point(1038, 532);
|
|
||||||
buttonUp.Margin = new Padding(0);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(35, 35);
|
|
||||||
buttonUp.TabIndex = 5;
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// comboBoxStrategy
|
|
||||||
//
|
|
||||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
comboBoxStrategy.Cursor = Cursors.SizeNESW;
|
|
||||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxStrategy.FormattingEnabled = true;
|
|
||||||
comboBoxStrategy.Items.AddRange(new object[] { "к центру", "к углу" });
|
|
||||||
comboBoxStrategy.Location = new Point(965, 12);
|
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
|
||||||
comboBoxStrategy.Size = new Size(151, 28);
|
|
||||||
comboBoxStrategy.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonStrategy
|
|
||||||
//
|
|
||||||
buttonStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonStrategy.Location = new Point(1022, 46);
|
|
||||||
buttonStrategy.Name = "buttonStrategy";
|
|
||||||
buttonStrategy.Size = new Size(94, 29);
|
|
||||||
buttonStrategy.TabIndex = 8;
|
|
||||||
buttonStrategy.Text = "Шаг";
|
|
||||||
buttonStrategy.UseVisualStyleBackColor = true;
|
|
||||||
buttonStrategy.Click += ButtonStrategy_Click;
|
|
||||||
//
|
|
||||||
// FormAircraftCarrier
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1128, 617);
|
|
||||||
Controls.Add(buttonStrategy);
|
|
||||||
Controls.Add(comboBoxStrategy);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(pictureBoxAircraftCarrier);
|
|
||||||
KeyPreview = true;
|
|
||||||
Name = "FormAircraftCarrier";
|
|
||||||
Text = "FormAircraftCarrier";
|
|
||||||
KeyDown += FormAircraftCarrier_KeyDown;
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxAircraftCarrier).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxAircraftCarrier;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonUp;
|
|
||||||
private ComboBox comboBoxStrategy;
|
|
||||||
private Button buttonStrategy;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
using System.Security.Cryptography;
|
|
||||||
using AircraftCarrier.Drawing;
|
|
||||||
using AircraftCarrier.Drawings;
|
|
||||||
using AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
namespace AircraftCarrier;
|
|
||||||
|
|
||||||
public partial class FormAircraftCarrier : Form
|
|
||||||
{
|
|
||||||
private DrawingSimpleAircraftCarrier? _drawingAircraftCarrier;
|
|
||||||
private AbstractStrategy? _strategy;
|
|
||||||
|
|
||||||
public DrawingSimpleAircraftCarrier setCar
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_drawingAircraftCarrier = value;
|
|
||||||
_drawingAircraftCarrier.SetPictureSize(
|
|
||||||
pictureBoxAircraftCarrier.Width,
|
|
||||||
pictureBoxAircraftCarrier.Height
|
|
||||||
);
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_strategy = null;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormAircraftCarrier()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_strategy = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawingAircraftCarrier == null) return;
|
|
||||||
Bitmap bmp = new Bitmap(pictureBoxAircraftCarrier.Width, pictureBoxAircraftCarrier.Height);
|
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
|
||||||
_drawingAircraftCarrier.DrawAircraftCarrier(g);
|
|
||||||
pictureBoxAircraftCarrier.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawingAircraftCarrier == null) return;
|
|
||||||
string nameButton = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
DirectionType? directionType = null;
|
|
||||||
switch (nameButton)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
directionType = DirectionType.Up;
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
directionType = DirectionType.Down;
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
directionType = DirectionType.Left;
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
directionType = DirectionType.Right;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (directionType.HasValue)
|
|
||||||
{
|
|
||||||
_drawingAircraftCarrier.MoveAircraftCarrier(directionType.Value);
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormAircraftCarrier_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawingAircraftCarrier == null) return;
|
|
||||||
DirectionType? directionType = null;
|
|
||||||
switch (e.KeyCode)
|
|
||||||
{
|
|
||||||
case Keys.W:
|
|
||||||
directionType = DirectionType.Up;
|
|
||||||
break;
|
|
||||||
case Keys.S:
|
|
||||||
directionType = DirectionType.Down;
|
|
||||||
break;
|
|
||||||
case Keys.A:
|
|
||||||
directionType = DirectionType.Left;
|
|
||||||
break;
|
|
||||||
case Keys.D:
|
|
||||||
directionType = DirectionType.Right;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (directionType.HasValue)
|
|
||||||
{
|
|
||||||
_drawingAircraftCarrier.MoveAircraftCarrier(directionType.Value);
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonStrategy_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawingAircraftCarrier == null) return;
|
|
||||||
if (comboBoxStrategy.Enabled)
|
|
||||||
{
|
|
||||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
|
||||||
{
|
|
||||||
0 => new MoveToCenter(),
|
|
||||||
1 => new MoveToCorner(),
|
|
||||||
_ => null
|
|
||||||
};
|
|
||||||
if (_strategy == null) return;
|
|
||||||
_strategy.SetData(new MoveableCarrier(_drawingAircraftCarrier), pictureBoxAircraftCarrier.Width, pictureBoxAircraftCarrier.Height);
|
|
||||||
}
|
|
||||||
if (_strategy == null) return;
|
|
||||||
|
|
||||||
comboBoxStrategy.Enabled = false;
|
|
||||||
_strategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
if (_strategy.GetStatus == StrategyStatus.Finish)
|
|
||||||
{
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_strategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<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" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,304 +0,0 @@
|
|||||||
namespace AircraftCarrier.CollectionGenericObjects
|
|
||||||
{
|
|
||||||
partial class FormShipCollection
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
groupBox1 = new GroupBox();
|
|
||||||
panel1 = new Panel();
|
|
||||||
buttonDelCollection = new Button();
|
|
||||||
textBoxNameCollection = new TextBox();
|
|
||||||
buttonCreateCollection = new Button();
|
|
||||||
listBoxCollection = new ListBox();
|
|
||||||
label1 = new Label();
|
|
||||||
radioButtonList = new RadioButton();
|
|
||||||
radioButtonMassive = new RadioButton();
|
|
||||||
buttonCreateCompany = new Button();
|
|
||||||
TextBoxIdAircraft = new MaskedTextBox();
|
|
||||||
buttonRefresh = new Button();
|
|
||||||
buttonTest = new Button();
|
|
||||||
buttonDeleteAircraft = new Button();
|
|
||||||
buttonCreateAircraft = new Button();
|
|
||||||
buttonCreateSimpleAircraft = new Button();
|
|
||||||
comboBoxStorage = new ComboBox();
|
|
||||||
pictureBox = new PictureBox();
|
|
||||||
panelTools = new Panel();
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
|
||||||
panelTools.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Controls.Add(buttonCreateCompany);
|
|
||||||
groupBox1.Controls.Add(comboBoxStorage);
|
|
||||||
groupBox1.Controls.Add(panel1);
|
|
||||||
groupBox1.Dock = DockStyle.Right;
|
|
||||||
groupBox1.Location = new Point(905, 0);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Size = new Size(250, 780);
|
|
||||||
groupBox1.TabIndex = 0;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
panel1.Controls.Add(buttonDelCollection);
|
|
||||||
panel1.Controls.Add(textBoxNameCollection);
|
|
||||||
panel1.Controls.Add(buttonCreateCollection);
|
|
||||||
panel1.Controls.Add(listBoxCollection);
|
|
||||||
panel1.Controls.Add(label1);
|
|
||||||
panel1.Controls.Add(radioButtonList);
|
|
||||||
panel1.Controls.Add(radioButtonMassive);
|
|
||||||
panel1.Location = new Point(0, 26);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(244, 320);
|
|
||||||
panel1.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonDelCollection
|
|
||||||
//
|
|
||||||
buttonDelCollection.Location = new Point(10, 281);
|
|
||||||
buttonDelCollection.Name = "buttonDelCollection";
|
|
||||||
buttonDelCollection.Size = new Size(217, 29);
|
|
||||||
buttonDelCollection.TabIndex = 6;
|
|
||||||
buttonDelCollection.Text = "Удалить Коллекцию";
|
|
||||||
buttonDelCollection.UseVisualStyleBackColor = true;
|
|
||||||
buttonDelCollection.Click += buttonDelCollection_Click;
|
|
||||||
//
|
|
||||||
// textBoxNameCollection
|
|
||||||
//
|
|
||||||
textBoxNameCollection.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
textBoxNameCollection.Location = new Point(10, 46);
|
|
||||||
textBoxNameCollection.Name = "textBoxNameCollection";
|
|
||||||
textBoxNameCollection.Size = new Size(223, 27);
|
|
||||||
textBoxNameCollection.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// buttonCreateCollection
|
|
||||||
//
|
|
||||||
buttonCreateCollection.Location = new Point(10, 116);
|
|
||||||
buttonCreateCollection.Name = "buttonCreateCollection";
|
|
||||||
buttonCreateCollection.Size = new Size(217, 29);
|
|
||||||
buttonCreateCollection.TabIndex = 4;
|
|
||||||
buttonCreateCollection.Text = "Добавить Коллекцию";
|
|
||||||
buttonCreateCollection.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateCollection.Click += buttonCreateCollection_Click;
|
|
||||||
//
|
|
||||||
// listBoxCollection
|
|
||||||
//
|
|
||||||
listBoxCollection.FormattingEnabled = true;
|
|
||||||
listBoxCollection.Location = new Point(10, 151);
|
|
||||||
listBoxCollection.Name = "listBoxCollection";
|
|
||||||
listBoxCollection.Size = new Size(217, 124);
|
|
||||||
listBoxCollection.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(39, 23);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(157, 20);
|
|
||||||
label1.TabIndex = 2;
|
|
||||||
label1.Text = "Название Коллекции";
|
|
||||||
//
|
|
||||||
// radioButtonList
|
|
||||||
//
|
|
||||||
radioButtonList.AutoSize = true;
|
|
||||||
radioButtonList.Location = new Point(147, 79);
|
|
||||||
radioButtonList.Name = "radioButtonList";
|
|
||||||
radioButtonList.Size = new Size(80, 24);
|
|
||||||
radioButtonList.TabIndex = 1;
|
|
||||||
radioButtonList.TabStop = true;
|
|
||||||
radioButtonList.Text = "Список";
|
|
||||||
radioButtonList.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// radioButtonMassive
|
|
||||||
//
|
|
||||||
radioButtonMassive.AutoSize = true;
|
|
||||||
radioButtonMassive.Location = new Point(10, 79);
|
|
||||||
radioButtonMassive.Name = "radioButtonMassive";
|
|
||||||
radioButtonMassive.RightToLeft = RightToLeft.No;
|
|
||||||
radioButtonMassive.Size = new Size(82, 24);
|
|
||||||
radioButtonMassive.TabIndex = 0;
|
|
||||||
radioButtonMassive.TabStop = true;
|
|
||||||
radioButtonMassive.Text = "Массив";
|
|
||||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonCreateCompany
|
|
||||||
//
|
|
||||||
buttonCreateCompany.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonCreateCompany.Location = new Point(14, 511);
|
|
||||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
|
||||||
buttonCreateCompany.Size = new Size(224, 30);
|
|
||||||
buttonCreateCompany.TabIndex = 8;
|
|
||||||
buttonCreateCompany.Text = "Создать Компанию";
|
|
||||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
|
||||||
//
|
|
||||||
// TextBoxIdAircraft
|
|
||||||
//
|
|
||||||
TextBoxIdAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
TextBoxIdAircraft.Location = new Point(14, 80);
|
|
||||||
TextBoxIdAircraft.Mask = "00";
|
|
||||||
TextBoxIdAircraft.Name = "TextBoxIdAircraft";
|
|
||||||
TextBoxIdAircraft.Size = new Size(224, 27);
|
|
||||||
TextBoxIdAircraft.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonRefresh.Location = new Point(14, 185);
|
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
|
||||||
buttonRefresh.Size = new Size(224, 30);
|
|
||||||
buttonRefresh.TabIndex = 5;
|
|
||||||
buttonRefresh.Text = "Обновить";
|
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
buttonRefresh.Click += buttonRefresh_Click;
|
|
||||||
//
|
|
||||||
// buttonTest
|
|
||||||
//
|
|
||||||
buttonTest.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonTest.Location = new Point(14, 149);
|
|
||||||
buttonTest.Name = "buttonTest";
|
|
||||||
buttonTest.Size = new Size(224, 30);
|
|
||||||
buttonTest.TabIndex = 4;
|
|
||||||
buttonTest.Text = "Тесты";
|
|
||||||
buttonTest.UseVisualStyleBackColor = true;
|
|
||||||
buttonTest.Click += buttonTest_Click;
|
|
||||||
//
|
|
||||||
// buttonDeleteAircraft
|
|
||||||
//
|
|
||||||
buttonDeleteAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonDeleteAircraft.Location = new Point(14, 113);
|
|
||||||
buttonDeleteAircraft.Name = "buttonDeleteAircraft";
|
|
||||||
buttonDeleteAircraft.Size = new Size(224, 30);
|
|
||||||
buttonDeleteAircraft.TabIndex = 3;
|
|
||||||
buttonDeleteAircraft.Text = "Удалить Авианосец";
|
|
||||||
buttonDeleteAircraft.UseVisualStyleBackColor = true;
|
|
||||||
buttonDeleteAircraft.Click += buttonDeleteAircraft_Click;
|
|
||||||
//
|
|
||||||
// buttonCreateAircraft
|
|
||||||
//
|
|
||||||
buttonCreateAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonCreateAircraft.Location = new Point(14, 44);
|
|
||||||
buttonCreateAircraft.Name = "buttonCreateAircraft";
|
|
||||||
buttonCreateAircraft.Size = new Size(224, 30);
|
|
||||||
buttonCreateAircraft.TabIndex = 2;
|
|
||||||
buttonCreateAircraft.Text = "Создать супер Авианосец";
|
|
||||||
buttonCreateAircraft.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateAircraft.Click += buttonCreateAircraft_Click;
|
|
||||||
//
|
|
||||||
// buttonCreateSimpleAircraft
|
|
||||||
//
|
|
||||||
buttonCreateSimpleAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonCreateSimpleAircraft.Location = new Point(14, 8);
|
|
||||||
buttonCreateSimpleAircraft.Name = "buttonCreateSimpleAircraft";
|
|
||||||
buttonCreateSimpleAircraft.Size = new Size(224, 30);
|
|
||||||
buttonCreateSimpleAircraft.TabIndex = 1;
|
|
||||||
buttonCreateSimpleAircraft.Text = "Создать Авианосец";
|
|
||||||
buttonCreateSimpleAircraft.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateSimpleAircraft.Click += buttonCreateSimpleAircraft_Click;
|
|
||||||
//
|
|
||||||
// comboBoxStorage
|
|
||||||
//
|
|
||||||
comboBoxStorage.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
comboBoxStorage.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxStorage.FormattingEnabled = true;
|
|
||||||
comboBoxStorage.Items.AddRange(new object[] { "Хранилище" });
|
|
||||||
comboBoxStorage.Location = new Point(14, 477);
|
|
||||||
comboBoxStorage.Name = "comboBoxStorage";
|
|
||||||
comboBoxStorage.Size = new Size(224, 28);
|
|
||||||
comboBoxStorage.TabIndex = 0;
|
|
||||||
comboBoxStorage.SelectedIndexChanged += comboBoxStorage_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// pictureBox
|
|
||||||
//
|
|
||||||
pictureBox.Dock = DockStyle.Fill;
|
|
||||||
pictureBox.Location = new Point(0, 0);
|
|
||||||
pictureBox.Name = "pictureBox";
|
|
||||||
pictureBox.Size = new Size(905, 780);
|
|
||||||
pictureBox.TabIndex = 1;
|
|
||||||
pictureBox.TabStop = false;
|
|
||||||
//
|
|
||||||
// panelTools
|
|
||||||
//
|
|
||||||
panelTools.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
panelTools.Controls.Add(buttonCreateSimpleAircraft);
|
|
||||||
panelTools.Controls.Add(TextBoxIdAircraft);
|
|
||||||
panelTools.Controls.Add(buttonCreateAircraft);
|
|
||||||
panelTools.Controls.Add(buttonRefresh);
|
|
||||||
panelTools.Controls.Add(buttonDeleteAircraft);
|
|
||||||
panelTools.Controls.Add(buttonTest);
|
|
||||||
panelTools.Location = new Point(905, 554);
|
|
||||||
panelTools.Name = "panelTools";
|
|
||||||
panelTools.Size = new Size(250, 226);
|
|
||||||
panelTools.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// FormShipCollection
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1155, 780);
|
|
||||||
Controls.Add(panelTools);
|
|
||||||
Controls.Add(pictureBox);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
Name = "FormShipCollection";
|
|
||||||
Text = "FormShipCollection";
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
panel1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
|
||||||
panelTools.ResumeLayout(false);
|
|
||||||
panelTools.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private PictureBox pictureBox;
|
|
||||||
private ComboBox comboBoxStorage;
|
|
||||||
private MaskedTextBox TextBoxIdAircraft;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private Button buttonTest;
|
|
||||||
private Button buttonDeleteAircraft;
|
|
||||||
private Button buttonCreateAircraft;
|
|
||||||
private Button buttonCreateSimpleAircraft;
|
|
||||||
private Panel panel1;
|
|
||||||
private Label label1;
|
|
||||||
private RadioButton radioButtonList;
|
|
||||||
private RadioButton radioButtonMassive;
|
|
||||||
private Button buttonCreateCompany;
|
|
||||||
private Button buttonDelCollection;
|
|
||||||
private TextBox textBoxNameCollection;
|
|
||||||
private Button buttonCreateCollection;
|
|
||||||
private ListBox listBoxCollection;
|
|
||||||
private Panel panel2;
|
|
||||||
private Panel panelTools;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,202 +0,0 @@
|
|||||||
using AircraftCarrier.Drawing;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public partial class FormShipCollection : Form
|
|
||||||
{
|
|
||||||
private StorageColletion<DrawingSimpleAircraftCarrier> _storageCollection;
|
|
||||||
private AbstractCompany? _company = null;
|
|
||||||
|
|
||||||
public FormShipCollection()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storageCollection = new();
|
|
||||||
panelTools.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBoxStorage_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
panelTools.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color GetColor(Random random)
|
|
||||||
{
|
|
||||||
Color c = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
|
||||||
ColorDialog dialog = new ColorDialog();
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
c = dialog.Color;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateAircraftCarrier(string name)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
Random random = new();
|
|
||||||
DrawingSimpleAircraftCarrier _drawingAircraftCarrier;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case nameof(DrawingAircraftCarrier):
|
|
||||||
_drawingAircraftCarrier = new DrawingAircraftCarrier(random.Next(100, 200), random.Next(1000, 2000),
|
|
||||||
GetColor(random),
|
|
||||||
GetColor(random),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
|
||||||
break;
|
|
||||||
case nameof(DrawingSimpleAircraftCarrier):
|
|
||||||
_drawingAircraftCarrier = new DrawingSimpleAircraftCarrier(
|
|
||||||
random.Next(100, 200),
|
|
||||||
random.Next(1000, 2000),
|
|
||||||
GetColor(random));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_company + _drawingAircraftCarrier)
|
|
||||||
{
|
|
||||||
MessageBox.Show("элемент добавлен");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("элемент не добавлен");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreateSimpleAircraft_Click(object sender, EventArgs e) => CreateAircraftCarrier(nameof(DrawingSimpleAircraftCarrier));
|
|
||||||
|
|
||||||
private void buttonCreateAircraft_Click(object sender, EventArgs e) => CreateAircraftCarrier(nameof(DrawingAircraftCarrier));
|
|
||||||
|
|
||||||
private void buttonDeleteAircraft_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(TextBoxIdAircraft.Text) || _company == null) return;
|
|
||||||
|
|
||||||
if (
|
|
||||||
MessageBox.Show(
|
|
||||||
"Удалить объект " + TextBoxIdAircraft.Text,
|
|
||||||
"Удаление",
|
|
||||||
MessageBoxButtons.YesNo,
|
|
||||||
MessageBoxIcon.Question) == DialogResult.No
|
|
||||||
) return;
|
|
||||||
|
|
||||||
int pos = Convert.ToInt32(TextBoxIdAircraft.Text);
|
|
||||||
if (_company - pos)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект удален");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не был удален");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonTest_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
DrawingSimpleAircraftCarrier? aircraft = null;
|
|
||||||
int counter = 100;
|
|
||||||
while (aircraft == null)
|
|
||||||
{
|
|
||||||
aircraft = _company.GetRandom();
|
|
||||||
counter--;
|
|
||||||
if (counter <= 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aircraft == null) return;
|
|
||||||
|
|
||||||
FormAircraftCarrier form = new();
|
|
||||||
form.setCar = aircraft;
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreateCollection_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxNameCollection.Text) | (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Некорректный набор данных");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CollectionType collectionType = CollectionType.Massive;
|
|
||||||
if (radioButtonMassive.Checked)
|
|
||||||
{
|
|
||||||
collectionType = CollectionType.Massive;
|
|
||||||
}
|
|
||||||
else if (radioButtonList.Checked)
|
|
||||||
{
|
|
||||||
collectionType = CollectionType.List;
|
|
||||||
}
|
|
||||||
_storageCollection.AddCollection(textBoxNameCollection.Text, collectionType);
|
|
||||||
RefreshListBoxItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshListBoxItem()
|
|
||||||
{
|
|
||||||
listBoxCollection.Items.Clear();
|
|
||||||
for (int i = 0; i < _storageCollection.Keys?.Count; i++)
|
|
||||||
{
|
|
||||||
string? colName = _storageCollection.Keys[i];
|
|
||||||
if (!string.IsNullOrEmpty(colName))
|
|
||||||
{
|
|
||||||
listBoxCollection.Items.Add(colName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDelCollection_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxCollection.SelectedItems.Count == 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранных элементов");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show(
|
|
||||||
"вы уверены, что хотите удалить " + listBoxCollection.SelectedItem?.ToString(),
|
|
||||||
"Предупреждение",
|
|
||||||
MessageBoxButtons.YesNo
|
|
||||||
) == DialogResult.No)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem?.ToString());
|
|
||||||
RefreshListBoxItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxCollection.SelectedItems.Count == 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICollectionGenericObjects<DrawingSimpleAircraftCarrier>? collections;
|
|
||||||
collections = _storageCollection[listBoxCollection.SelectedItem?.ToString() ?? string.Empty];
|
|
||||||
if (collections == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не проинициализирована");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch (comboBoxStorage.Text)
|
|
||||||
{
|
|
||||||
case "Хранилище":
|
|
||||||
_company = new DocksService(
|
|
||||||
pictureBox.Width,
|
|
||||||
pictureBox.Height,
|
|
||||||
collections
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pictureBox.Image = _company?.Show();
|
|
||||||
panelTools.Enabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
private IMoveableObject? _moveableObject;
|
|
||||||
private StrategyStatus _state = StrategyStatus.NotInit;
|
|
||||||
protected int FieldWidth { get; private set; }
|
|
||||||
protected int FieldHeight { get; private set; }
|
|
||||||
public StrategyStatus GetStatus => _state;
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
|
||||||
{
|
|
||||||
if (moveableObject == null)
|
|
||||||
{
|
|
||||||
_state = StrategyStatus.NotInit;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_state = StrategyStatus.InProgress;
|
|
||||||
_moveableObject = moveableObject;
|
|
||||||
FieldWidth = width;
|
|
||||||
FieldHeight = height;
|
|
||||||
}
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
if (_state != StrategyStatus.InProgress) return;
|
|
||||||
if (IsTargetDestination())
|
|
||||||
{
|
|
||||||
_state = StrategyStatus.Finish;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
|
||||||
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
|
||||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
|
||||||
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
|
||||||
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
protected abstract bool IsTargetDestination();
|
|
||||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
|
||||||
|
|
||||||
protected int? GetStep()
|
|
||||||
{
|
|
||||||
if (_state != StrategyStatus.InProgress) return null;
|
|
||||||
return _moveableObject?.GetStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool MoveTo(MovementDirection direction)
|
|
||||||
{
|
|
||||||
if (_state != StrategyStatus.InProgress)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _moveableObject?.TryMoveObject(direction) ?? false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public interface IMoveableObject
|
|
||||||
{
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
int GetStep { get; }
|
|
||||||
bool TryMoveObject(MovementDirection direction);
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public class MoveToCenter : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestination()
|
|
||||||
{
|
|
||||||
ObjectParameters? objectParameters = GetObjectParameters;
|
|
||||||
if (objectParameters == null) return false;
|
|
||||||
return objectParameters.CenterX - GetStep() <= FieldWidth/2 && objectParameters.CenterX + GetStep() >= FieldWidth/2 &&
|
|
||||||
objectParameters.CenterY - GetStep() <= FieldHeight/2 && objectParameters.CenterY + GetStep() >= FieldHeight/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
ObjectParameters? objectParameters = GetObjectParameters;
|
|
||||||
if (objectParameters == null) return;
|
|
||||||
|
|
||||||
int diffX = objectParameters.CenterX - FieldWidth / 2;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int diffY = objectParameters.CenterY - FieldHeight / 2;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public class MoveToCorner : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestination()
|
|
||||||
{
|
|
||||||
ObjectParameters? objectParameters = GetObjectParameters;
|
|
||||||
if (objectParameters == null) return false;
|
|
||||||
return objectParameters.RightBorder + GetStep() >= FieldWidth && objectParameters.BottomBorder + GetStep() >= FieldHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
ObjectParameters? objectParameters = GetObjectParameters;
|
|
||||||
if (objectParameters == null) return;
|
|
||||||
|
|
||||||
int diffX = objectParameters.CenterX - FieldWidth;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
int diffY = objectParameters.CenterY - FieldHeight;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
using AircraftCarrier.Drawing;
|
|
||||||
using AircraftCarrier.Drawings;
|
|
||||||
|
|
||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public class MoveableCarrier : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly DrawingSimpleAircraftCarrier? _aircraftCarrier = null;
|
|
||||||
|
|
||||||
public MoveableCarrier(DrawingSimpleAircraftCarrier aircraftCarrier)
|
|
||||||
{
|
|
||||||
_aircraftCarrier = aircraftCarrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_aircraftCarrier == null || _aircraftCarrier.entityAircraftCarrier == null ||
|
|
||||||
!_aircraftCarrier.GetPosX.HasValue || !_aircraftCarrier.GetPosY.HasValue)
|
|
||||||
return null;
|
|
||||||
return new ObjectParameters(_aircraftCarrier.GetPosX.Value, _aircraftCarrier.GetPosY.Value, _aircraftCarrier.GetWidth, _aircraftCarrier.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetStep => (int)(_aircraftCarrier?.entityAircraftCarrier?.Step ?? 0);
|
|
||||||
|
|
||||||
public bool TryMoveObject(MovementDirection direction)
|
|
||||||
{
|
|
||||||
if (_aircraftCarrier == null || _aircraftCarrier.entityAircraftCarrier == null)
|
|
||||||
return false;
|
|
||||||
return _aircraftCarrier.MoveAircraftCarrier(GetDirectionType(direction));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DirectionType GetDirectionType(MovementDirection direction)
|
|
||||||
{
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
MovementDirection.Up => DirectionType.Up,
|
|
||||||
MovementDirection.Down => DirectionType.Down,
|
|
||||||
MovementDirection.Left => DirectionType.Left,
|
|
||||||
MovementDirection.Right => DirectionType.Right,
|
|
||||||
_ => DirectionType.Unknown,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public enum MovementDirection
|
|
||||||
{
|
|
||||||
Up = 1,
|
|
||||||
Down = 2,
|
|
||||||
Left = 3,
|
|
||||||
Right = 4
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public class ObjectParameters
|
|
||||||
{
|
|
||||||
private readonly int _x;
|
|
||||||
private readonly int _y;
|
|
||||||
private readonly int _width;
|
|
||||||
private readonly int _height;
|
|
||||||
|
|
||||||
public int LeftBorder => _x;
|
|
||||||
public int RightBorder => _x + _width;
|
|
||||||
public int TopBorder => _y;
|
|
||||||
public int BottomBorder => _y + _height;
|
|
||||||
public int CenterX => _x + _width / 2;
|
|
||||||
public int CenterY => _y + _height / 2;
|
|
||||||
public ObjectParameters(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
_x = x;
|
|
||||||
_y = y;
|
|
||||||
_width = width;
|
|
||||||
_height = height;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace AircraftCarrier.MovementStategy;
|
|
||||||
|
|
||||||
public enum StrategyStatus
|
|
||||||
{
|
|
||||||
NotInit,
|
|
||||||
InProgress,
|
|
||||||
Finish
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
using AircraftCarrier.CollectionGenericObjects;
|
|
||||||
|
|
||||||
namespace AircraftCarrier
|
namespace AircraftCarrier
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -13,8 +11,7 @@ namespace AircraftCarrier
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
//Application.Run(new FormAircraftCarrier());
|
Application.Run(new Form1());
|
||||||
Application.Run(new FormShipCollection());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace AircraftCarrier.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("AircraftCarrier.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap down_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("down-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap left_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("left-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap right_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("right-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap up_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("up-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<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" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="down-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>down-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="left-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>left-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="right-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>right-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="up-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>up-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 361 B |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Loading…
x
Reference in New Issue
Block a user