Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54c2da98b6 |
@@ -8,18 +8,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.5" />
|
||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber.Generics
|
||||
{
|
||||
internal class BomberCollectionInfo : IEquatable<BomberCollectionInfo>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public BomberCollectionInfo(string name, string description)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
}
|
||||
public bool Equals(BomberCollectionInfo? other)
|
||||
{
|
||||
if (other == null || Name == null || other.Name == null) return false;
|
||||
if (Name == other.Name) return true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name?.GetHashCode() ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using AirBomber.DrawningObjects;
|
||||
using AirBomber.Entities;
|
||||
using AirBomber.Generics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class BomberCompareByColor : IComparer<DrawningBomber?>
|
||||
{
|
||||
public int Compare(DrawningBomber? x, DrawningBomber? y)
|
||||
{
|
||||
if (x == null || x.EntityBomber == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
}
|
||||
if (y == null || y.EntityBomber == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
}
|
||||
if (x.EntityBomber.BodyColor != y.EntityBomber.BodyColor)
|
||||
{
|
||||
return x.EntityBomber.BodyColor.Name.CompareTo(y.EntityBomber.BodyColor.Name);
|
||||
}
|
||||
if (x.GetType() == y.GetType() && x is DrawningAirBomber)
|
||||
{
|
||||
return ((EntityAirBomber)x.EntityBomber).DopColor.Name.CompareTo(((EntityAirBomber)y.EntityBomber).DopColor.Name);
|
||||
}
|
||||
var speedCompare = x.EntityBomber.Speed.CompareTo(y.EntityBomber.Speed);
|
||||
if (speedCompare != 0)
|
||||
{
|
||||
return speedCompare;
|
||||
}
|
||||
return x.EntityBomber.Weight.CompareTo(y.EntityBomber.Weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using AirBomber.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class BomberCompareByType : IComparer<DrawningBomber?>
|
||||
{
|
||||
public int Compare(DrawningBomber? x, DrawningBomber? y)
|
||||
{
|
||||
if (x == null || x.EntityBomber == null)
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
|
||||
if (y == null || y.EntityBomber == null)
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
|
||||
if (x.GetType().Name != y.GetType().Name)
|
||||
{
|
||||
return x.GetType().Name.CompareTo(y.GetType().Name);
|
||||
}
|
||||
var speedCompare = x.EntityBomber.Speed.CompareTo(y.EntityBomber.Speed);
|
||||
|
||||
if (speedCompare != 0)
|
||||
return speedCompare;
|
||||
|
||||
return x.EntityBomber.Weight.CompareTo(y.EntityBomber.Weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
||||
using AirBomber.DrawningObjects;
|
||||
using AirBomber.MovementStrategy;
|
||||
using ProjectBomber.Generics;
|
||||
using Microsoft.VisualBasic.Logging;
|
||||
|
||||
|
||||
namespace AirBomber.Generics
|
||||
@@ -15,17 +14,12 @@ namespace AirBomber.Generics
|
||||
where T : DrawningBomber
|
||||
where U : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T?> GetPlane => _collection.GetPlane();
|
||||
|
||||
private readonly int _pictureWidth;
|
||||
private readonly int _pictureHeight;
|
||||
private readonly int _placeSizeWidth = 155;
|
||||
private readonly int _placeSizeHeight = 185;
|
||||
private readonly SetGeneric<T> _collection;
|
||||
public void Sort(IComparer<T?> comparer) => _collection.SortSet(comparer);
|
||||
|
||||
public BomberGenericCollection(int picWidth, int picHeight)
|
||||
{
|
||||
int width = picWidth / _placeSizeWidth;
|
||||
@@ -35,23 +29,24 @@ namespace AirBomber.Generics
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
|
||||
public static bool operator +(BomberGenericCollection<T, U> collect, T? obj)
|
||||
public static int operator +(BomberGenericCollection<T, U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return collect._collection.Insert(obj);
|
||||
}
|
||||
|
||||
public static bool operator -(BomberGenericCollection<T, U> collect, int
|
||||
pos)
|
||||
{
|
||||
T? obj = collect._collection[pos];
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return collect?._collection.Insert(obj, new DrawningBomberEqutables()) ?? false;
|
||||
}
|
||||
|
||||
public static T? operator -(BomberGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection[pos];
|
||||
if (obj != null)
|
||||
{
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return obj;
|
||||
return collect._collection.Remove(pos);
|
||||
}
|
||||
|
||||
public U? GetU(int pos)
|
||||
|
||||
@@ -4,19 +4,18 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AirBomber.DrawningObjects;
|
||||
using AirBomber.Exceptions;
|
||||
using AirBomber.MovementStrategy;
|
||||
|
||||
namespace AirBomber.Generics
|
||||
{
|
||||
internal class BomberGenericStorage
|
||||
{
|
||||
readonly Dictionary<BomberCollectionInfo, BomberGenericCollection<DrawningBomber, DrawningObjectBomber>> _bomberStorage;
|
||||
readonly Dictionary<string, BomberGenericCollection<DrawningBomber, DrawningObjectBomber>> _bomberStorage;
|
||||
|
||||
/// <summary>
|
||||
/// Возвращение списка названий наборов
|
||||
/// </summary>
|
||||
public List<BomberCollectionInfo> Keys => _bomberStorage.Keys.ToList();
|
||||
public List<string> Keys => _bomberStorage.Keys.ToList();
|
||||
/// <summary>
|
||||
/// Ширина окна отрисовки
|
||||
/// </summary>
|
||||
@@ -26,146 +25,45 @@ namespace AirBomber.Generics
|
||||
/// </summary>
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private static readonly char _separatorForKeyValue = '|';
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly char _separatorRecords = ';';
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly char _separatorForObject = ':';
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="pictureWidth"></param>
|
||||
/// <param name="pictureHeight"></param>
|
||||
public BomberGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_bomberStorage = new Dictionary<BomberCollectionInfo, BomberGenericCollection<DrawningBomber, DrawningObjectBomber>>();
|
||||
_bomberStorage = new Dictionary<string, BomberGenericCollection<DrawningBomber, DrawningObjectBomber>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
public void AddSet(string name)
|
||||
{
|
||||
// TODO Прописать логику для добавления
|
||||
if (!_bomberStorage.ContainsKey(new BomberCollectionInfo(name, string.Empty)))
|
||||
if (!_bomberStorage.ContainsKey(name))
|
||||
{
|
||||
var bomberCollection = new BomberGenericCollection<DrawningBomber, DrawningObjectBomber>(_pictureWidth, _pictureHeight);
|
||||
_bomberStorage.Add(new BomberCollectionInfo(name, string.Empty), bomberCollection);
|
||||
_bomberStorage.Add(name, bomberCollection);
|
||||
}
|
||||
}
|
||||
|
||||
public void DelSet(string name)
|
||||
{
|
||||
// TODO Прописать логику для удаления
|
||||
if (_bomberStorage.ContainsKey(new BomberCollectionInfo(name, string.Empty)))
|
||||
if (_bomberStorage.ContainsKey(name))
|
||||
{
|
||||
_bomberStorage.Remove(new BomberCollectionInfo(name, string.Empty));
|
||||
_bomberStorage.Remove(name);
|
||||
}
|
||||
}
|
||||
public BomberGenericCollection<DrawningBomber, DrawningObjectBomber>? this[string ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
BomberCollectionInfo indObj = new BomberCollectionInfo(ind, string.Empty);
|
||||
// TODO Продумать логику получения набора
|
||||
if (_bomberStorage.ContainsKey(indObj))
|
||||
if (_bomberStorage.ContainsKey(ind))
|
||||
{
|
||||
return _bomberStorage[indObj];
|
||||
return _bomberStorage[ind];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public void SaveData(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
StringBuilder data = new();
|
||||
foreach (KeyValuePair<BomberCollectionInfo, BomberGenericCollection<DrawningBomber, DrawningObjectBomber>> record in _bomberStorage)
|
||||
{
|
||||
StringBuilder records = new();
|
||||
foreach (DrawningBomber? elem in record.Value.GetPlane)
|
||||
{
|
||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||
}
|
||||
data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}");
|
||||
}
|
||||
if (data.Length == 0)
|
||||
{
|
||||
throw new Exception("Невалидная операция, нет данных для сохранения");
|
||||
}
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(filename))
|
||||
{
|
||||
writer.Write($"BomberStorage{Environment.NewLine}{data}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка информации по установкам в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public void LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
throw new Exception("Файл не найден");
|
||||
}
|
||||
|
||||
using (StreamReader reader = new StreamReader(filename))
|
||||
{
|
||||
string cheker = reader.ReadLine();
|
||||
if (cheker == null)
|
||||
{
|
||||
throw new Exception("Нет данных для загрузки");
|
||||
}
|
||||
if (!cheker.StartsWith("BomberStorage"))
|
||||
{
|
||||
throw new Exception("Неверный формат ввода");
|
||||
}
|
||||
_bomberStorage.Clear();
|
||||
string strs;
|
||||
bool firstinit = true;
|
||||
while ((strs = reader.ReadLine()) != null)
|
||||
{
|
||||
if (strs == null && firstinit)
|
||||
{
|
||||
throw new Exception("Нет данных для загрузки");
|
||||
}
|
||||
if (strs == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
firstinit = false;
|
||||
string name = strs.Split(_separatorForKeyValue)[0];
|
||||
BomberGenericCollection<DrawningBomber, DrawningObjectBomber> collection = new(_pictureWidth, _pictureHeight);
|
||||
foreach (string data in strs.Split(_separatorForKeyValue)[1].Split(_separatorRecords))
|
||||
{
|
||||
DrawningBomber? air =
|
||||
data?.CreateDrawningBomber(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||
if (air != null)
|
||||
{
|
||||
try { _ = collection + air; }
|
||||
catch (BomberNotFoundException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (StorageOverflowException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_bomberStorage.Add(new BomberCollectionInfo(name, string.Empty), collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
internal class BomberNotFoundException : ApplicationException
|
||||
{
|
||||
public BomberNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
|
||||
public BomberNotFoundException() : base() { }
|
||||
public BomberNotFoundException(string message) : base(message) { }
|
||||
public BomberNotFoundException(string message, Exception exception) : base(message, exception) { }
|
||||
protected BomberNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using AirBomber.DrawningObjects;
|
||||
using AirBomber.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class DrawningBomberEqutables : IEqualityComparer<DrawningBomber?>
|
||||
{
|
||||
public bool Equals(DrawningBomber? x, DrawningBomber? y)
|
||||
{
|
||||
if (x == null || x.EntityBomber == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
}
|
||||
if (y == null || y.EntityBomber == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
}
|
||||
if (x.GetType().Name != y.GetType().Name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (x.EntityBomber.Speed != y.EntityBomber.Speed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (x.EntityBomber.Weight != y.EntityBomber.Weight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (x.EntityBomber.BodyColor != y.EntityBomber.BodyColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (x is EntityAirBomber && y is EntityAirBomber)
|
||||
{
|
||||
EntityAirBomber EntityX = (EntityAirBomber)x.EntityBomber;
|
||||
EntityAirBomber EntityY = (EntityAirBomber)y.EntityBomber;
|
||||
if (EntityX.DopColor != EntityY.DopColor)
|
||||
return false;
|
||||
if (EntityX.Toplivo != EntityY.Toplivo)
|
||||
return false;
|
||||
if (EntityX.Rocket != EntityY.Rocket)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int GetHashCode([DisallowNull] DrawningBomber obj)
|
||||
{
|
||||
return obj.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using AirBomber.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber.DrawningObjects
|
||||
{
|
||||
public static class ExtentionDrawningBomber
|
||||
{
|
||||
/// <summary>
|
||||
/// Создание объекта из строки
|
||||
/// </summary>
|
||||
/// <param name="info">Строка с данными для создания объекта</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawningBomber? CreateDrawningBomber(this string info, char separatorForObject, int width, int height)
|
||||
{
|
||||
string[] strs = info.Split(separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
{
|
||||
return new DrawningBomber(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||
}
|
||||
else if (strs.Length == 6)
|
||||
{
|
||||
return new DrawningAirBomber(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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение данных для сохранения в файл
|
||||
/// </summary>
|
||||
/// <param name="drawningBomber">Сохраняемый объект</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawningBomber drawningBomber,
|
||||
char separatorForAir)
|
||||
{
|
||||
var air = drawningBomber.EntityBomber;
|
||||
if (air == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var str =
|
||||
$"{air.Speed}{separatorForAir}{air.Weight}{separatorForAir}{air.BodyColor.Name}";
|
||||
if (air is not EntityAirBomber airBomber)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return $"{str}{separatorForAir}{airBomber.DopColor.Name}{separatorForAir}{airBomber.Toplivo}{separatorForAir}{airBomber.Rocket}";
|
||||
}
|
||||
}
|
||||
}
|
||||
106
AirBomber/FormBomberCollection.Designer.cs
generated
106
AirBomber/FormBomberCollection.Designer.cs
generated
@@ -29,8 +29,6 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Tools = new GroupBox();
|
||||
ButtonSortByColor = new Button();
|
||||
ButtonSortByType = new Button();
|
||||
Kit = new GroupBox();
|
||||
RemoveKit = new Button();
|
||||
AddKit = new Button();
|
||||
@@ -41,22 +39,13 @@
|
||||
ButtonAddBomber = new Button();
|
||||
MessageBoxBomber = new TextBox();
|
||||
PicBoxBomberCollection = new PictureBox();
|
||||
menuStrip = new MenuStrip();
|
||||
fileToolStripMenuItem = new ToolStripMenuItem();
|
||||
SaveToolStripMenuItem = new ToolStripMenuItem();
|
||||
LoadToolStripMenuItem = new ToolStripMenuItem();
|
||||
openFileDialog = new OpenFileDialog();
|
||||
saveFileDialog = new OpenFileDialog();
|
||||
Tools.SuspendLayout();
|
||||
Kit.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)PicBoxBomberCollection).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// Tools
|
||||
//
|
||||
Tools.Controls.Add(ButtonSortByColor);
|
||||
Tools.Controls.Add(ButtonSortByType);
|
||||
Tools.Controls.Add(Kit);
|
||||
Tools.Controls.Add(ButtonRefreshCollection);
|
||||
Tools.Controls.Add(ButtonRemoveBomber);
|
||||
@@ -64,31 +53,11 @@
|
||||
Tools.Controls.Add(MessageBoxBomber);
|
||||
Tools.Location = new Point(538, 5);
|
||||
Tools.Name = "Tools";
|
||||
Tools.Size = new Size(250, 595);
|
||||
Tools.Size = new Size(250, 556);
|
||||
Tools.TabIndex = 0;
|
||||
Tools.TabStop = false;
|
||||
Tools.Text = "Инструменты";
|
||||
//
|
||||
// ButtonSortByColor
|
||||
//
|
||||
ButtonSortByColor.Location = new Point(28, 372);
|
||||
ButtonSortByColor.Name = "ButtonSortByColor";
|
||||
ButtonSortByColor.Size = new Size(192, 37);
|
||||
ButtonSortByColor.TabIndex = 6;
|
||||
ButtonSortByColor.Text = "Сортировка по цвету";
|
||||
ButtonSortByColor.UseVisualStyleBackColor = true;
|
||||
ButtonSortByColor.Click += ButtonSortByColor_Click;
|
||||
//
|
||||
// ButtonSortByType
|
||||
//
|
||||
ButtonSortByType.Location = new Point(29, 329);
|
||||
ButtonSortByType.Name = "ButtonSortByType";
|
||||
ButtonSortByType.Size = new Size(192, 37);
|
||||
ButtonSortByType.TabIndex = 5;
|
||||
ButtonSortByType.Text = "Сортировка по типу";
|
||||
ButtonSortByType.UseVisualStyleBackColor = true;
|
||||
ButtonSortByType.Click += ButtonSortByType_Click;
|
||||
//
|
||||
// Kit
|
||||
//
|
||||
Kit.Controls.Add(RemoveKit);
|
||||
@@ -97,7 +66,7 @@
|
||||
Kit.Controls.Add(listBoxStorages);
|
||||
Kit.Location = new Point(17, 33);
|
||||
Kit.Name = "Kit";
|
||||
Kit.Size = new Size(227, 283);
|
||||
Kit.Size = new Size(227, 282);
|
||||
Kit.TabIndex = 4;
|
||||
Kit.TabStop = false;
|
||||
Kit.Text = "Наборы";
|
||||
@@ -124,7 +93,7 @@
|
||||
//
|
||||
// KitTextbox
|
||||
//
|
||||
KitTextbox.Location = new Point(15, 29);
|
||||
KitTextbox.Location = new Point(15, 30);
|
||||
KitTextbox.Name = "KitTextbox";
|
||||
KitTextbox.Size = new Size(189, 27);
|
||||
KitTextbox.TabIndex = 1;
|
||||
@@ -141,7 +110,7 @@
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
ButtonRefreshCollection.Location = new Point(27, 545);
|
||||
ButtonRefreshCollection.Location = new Point(28, 481);
|
||||
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
ButtonRefreshCollection.Size = new Size(193, 37);
|
||||
ButtonRefreshCollection.TabIndex = 3;
|
||||
@@ -151,7 +120,7 @@
|
||||
//
|
||||
// ButtonRemoveBomber
|
||||
//
|
||||
ButtonRemoveBomber.Location = new Point(27, 498);
|
||||
ButtonRemoveBomber.Location = new Point(28, 416);
|
||||
ButtonRemoveBomber.Name = "ButtonRemoveBomber";
|
||||
ButtonRemoveBomber.Size = new Size(193, 41);
|
||||
ButtonRemoveBomber.TabIndex = 2;
|
||||
@@ -161,7 +130,7 @@
|
||||
//
|
||||
// ButtonAddBomber
|
||||
//
|
||||
ButtonAddBomber.Location = new Point(27, 418);
|
||||
ButtonAddBomber.Location = new Point(28, 321);
|
||||
ButtonAddBomber.Name = "ButtonAddBomber";
|
||||
ButtonAddBomber.Size = new Size(193, 41);
|
||||
ButtonAddBomber.TabIndex = 1;
|
||||
@@ -171,70 +140,26 @@
|
||||
//
|
||||
// MessageBoxBomber
|
||||
//
|
||||
MessageBoxBomber.Location = new Point(27, 465);
|
||||
MessageBoxBomber.Location = new Point(28, 368);
|
||||
MessageBoxBomber.Name = "MessageBoxBomber";
|
||||
MessageBoxBomber.Size = new Size(193, 27);
|
||||
MessageBoxBomber.TabIndex = 0;
|
||||
//
|
||||
// PicBoxBomberCollection
|
||||
//
|
||||
PicBoxBomberCollection.Location = new Point(8, 37);
|
||||
PicBoxBomberCollection.Location = new Point(1, -2);
|
||||
PicBoxBomberCollection.Name = "PicBoxBomberCollection";
|
||||
PicBoxBomberCollection.Size = new Size(478, 563);
|
||||
PicBoxBomberCollection.Size = new Size(473, 563);
|
||||
PicBoxBomberCollection.TabIndex = 1;
|
||||
PicBoxBomberCollection.TabStop = false;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(6, 3, 0, 3);
|
||||
menuStrip.Size = new Size(800, 30);
|
||||
menuStrip.TabIndex = 2;
|
||||
menuStrip.Text = "Файл";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem });
|
||||
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
fileToolStripMenuItem.Size = new Size(59, 24);
|
||||
fileToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// SaveToolStripMenuItem
|
||||
//
|
||||
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||
SaveToolStripMenuItem.Size = new Size(177, 26);
|
||||
SaveToolStripMenuItem.Text = "Сохранение";
|
||||
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||
//
|
||||
// LoadToolStripMenuItem
|
||||
//
|
||||
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||
LoadToolStripMenuItem.Size = new Size(177, 26);
|
||||
LoadToolStripMenuItem.Text = "Загрузка";
|
||||
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.FileName = "openFileDialog";
|
||||
openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
saveFileDialog.FileName = "saveFileDialog";
|
||||
saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormBomberCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 623);
|
||||
ClientSize = new Size(800, 581);
|
||||
Controls.Add(PicBoxBomberCollection);
|
||||
Controls.Add(Tools);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormBomberCollection";
|
||||
Text = "FormBomberCollection";
|
||||
Tools.ResumeLayout(false);
|
||||
@@ -242,10 +167,7 @@
|
||||
Kit.ResumeLayout(false);
|
||||
Kit.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)PicBoxBomberCollection).EndInit();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -261,13 +183,5 @@
|
||||
private Button RemoveKit;
|
||||
private Button AddKit;
|
||||
private TextBox KitTextbox;
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem fileToolStripMenuItem;
|
||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private OpenFileDialog saveFileDialog;
|
||||
private Button ButtonSortByColor;
|
||||
private Button ButtonSortByType;
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using AirBomber.Exceptions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
@@ -20,13 +17,10 @@ namespace AirBomber
|
||||
{
|
||||
private readonly BomberGenericStorage _bomber;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public FormBomberCollection(ILogger<FormBomberCollection> logger)
|
||||
public FormBomberCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_bomber = new BomberGenericStorage(PicBoxBomberCollection.Width, PicBoxBomberCollection.Height);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private void ReloadObjects()
|
||||
@@ -35,7 +29,7 @@ namespace AirBomber
|
||||
listBoxStorages.Items.Clear();
|
||||
for (int i = 0; i < _bomber.Keys.Count; i++)
|
||||
{
|
||||
listBoxStorages.Items.Add(_bomber.Keys[i].Name);
|
||||
listBoxStorages.Items.Add(_bomber.Keys[i]);
|
||||
}
|
||||
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||
>= listBoxStorages.Items.Count))
|
||||
@@ -63,50 +57,41 @@ namespace AirBomber
|
||||
}
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
}
|
||||
private void AddBomber(DrawningBomber bomber)
|
||||
{
|
||||
|
||||
var obj = _bomber[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
_logger.LogWarning("Добавление пустого объекта");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_ = obj + bomber;
|
||||
|
||||
MessageBox.Show("Объект добавлен");
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
_logger.LogInformation($"Добавлен объект в набор {listBoxStorages.SelectedItem.ToString()}");
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
MessageBox.Show("Такой объект уже существует");
|
||||
_logger.LogWarning($"{ex.Message} в наборе {listBoxStorages.SelectedItem.ToString()}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
_logger.LogWarning($"{ex.Message} в наборе {listBoxStorages.SelectedItem.ToString()}");
|
||||
}
|
||||
}
|
||||
private void ButtonAddBomber_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormBomberConfig form = new FormBomberConfig();
|
||||
form.Show();
|
||||
form.AddEvent(AddBomber);
|
||||
var formBomberConfig = new FormBomberConfig();
|
||||
|
||||
formBomberConfig.AddEvent(bomber =>
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex != -1)
|
||||
{
|
||||
var obj = _bomber[listBoxStorages.SelectedItem?.ToString() ?? string.Empty];
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj + bomber != 1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
formBomberConfig.Show();
|
||||
}
|
||||
|
||||
private void ButtonRemoveBomber_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
_logger.LogWarning("Удаление объекта из несуществующего набора");
|
||||
return;
|
||||
}
|
||||
var obj = _bomber[listBoxStorages.SelectedItem.ToString() ??
|
||||
@@ -121,24 +106,14 @@ namespace AirBomber
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(MessageBoxBomber.Text);
|
||||
try
|
||||
if (obj - pos != null)
|
||||
{
|
||||
if (obj - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
_logger.LogInformation($"Удален объект из набора {listBoxStorages.SelectedItem.ToString()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
_logger.LogWarning($"Не удалось удалить объект из набора {listBoxStorages.SelectedItem.ToString()}");
|
||||
}
|
||||
MessageBox.Show("Объект удален");
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
}
|
||||
catch (BomberNotFoundException ex)
|
||||
else
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
_logger.LogWarning($"{ex.Message} из набора {listBoxStorages.SelectedItem.ToString()}");
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,28 +123,23 @@ namespace AirBomber
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_logger.LogWarning("Пустое название набора");
|
||||
return;
|
||||
}
|
||||
_bomber.AddSet(KitTextbox.Text);
|
||||
ReloadObjects();
|
||||
_logger.LogInformation($"Добавлен набор: {KitTextbox.Text}");
|
||||
}
|
||||
|
||||
private void RemoveKit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
_logger.LogWarning("Удаление невыбранного набора");
|
||||
return;
|
||||
}
|
||||
string name = listBoxStorages.SelectedItem.ToString() ?? string.Empty;
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_bomber.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||
?? string.Empty);
|
||||
ReloadObjects();
|
||||
_logger.LogInformation($"Удален набор: {name}");
|
||||
}
|
||||
}
|
||||
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -177,62 +147,5 @@ namespace AirBomber
|
||||
PicBoxBomberCollection.Image =
|
||||
_bomber[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowBomber();
|
||||
}
|
||||
|
||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
_bomber.SaveData(saveFileDialog.FileName);
|
||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
_logger.LogInformation($"Сохранение наборов в файл {saveFileDialog.FileName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_logger.LogWarning($"Не удалось сохранить наборы с ошибкой: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
_bomber.LoadData(openFileDialog.FileName);
|
||||
ReloadObjects();
|
||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
_logger.LogInformation($"Загрузились наборы из файла {openFileDialog.FileName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Не загрузилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_logger.LogWarning($"Не удалось сохранить наборы с ошибкой: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSortByType_Click(object sender, EventArgs e) => CompareBombers(new BomberCompareByType());
|
||||
|
||||
private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareBombers(new BomberCompareByColor());
|
||||
|
||||
private void CompareBombers(IComparer<DrawningBomber?> comparer)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _bomber[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj.Sort(comparer);
|
||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,16 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 1</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>315, 1</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>62</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,8 +1,3 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal static class Program
|
||||
@@ -16,30 +11,7 @@ namespace AirBomber
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
|
||||
{
|
||||
Application.Run(serviceProvider.GetRequiredService<FormBomberCollection>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<FormBomberCollection>().AddLogging(option =>
|
||||
{
|
||||
string[] path = Directory.GetCurrentDirectory().Split('\\');
|
||||
string pathNeed = "";
|
||||
for (int i = 0; i < path.Length - 3; i++)
|
||||
{
|
||||
pathNeed += path[i] + "\\";
|
||||
}
|
||||
var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile(path: $"{pathNeed}appsettings.json", optional: false, reloadOnChange: true).Build(); var logger = new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger();
|
||||
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddSerilog(logger);
|
||||
});
|
||||
Application.Run(new FormBomberCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using AirBomber.Exceptions;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
@@ -36,17 +35,14 @@ namespace ProjectBomber.Generics
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(count);
|
||||
}
|
||||
|
||||
public void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="plane">Добавляемая установка</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T plane, IEqualityComparer<T>? equal = null)
|
||||
public int Insert(T plane)
|
||||
{
|
||||
Insert(plane, 0, equal);
|
||||
return true;
|
||||
return Insert(plane, 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор на конкретную позицию
|
||||
@@ -54,20 +50,16 @@ namespace ProjectBomber.Generics
|
||||
/// <param name="plane">Добавляемая установка</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T plane, int position, IEqualityComparer<T>? equal = null)
|
||||
public int Insert(T plane, int position)
|
||||
{
|
||||
if (position < 0 || position >= _maxCount)
|
||||
throw new BomberNotFoundException(position);
|
||||
return -1;
|
||||
|
||||
if (Count >= _maxCount)
|
||||
throw new StorageOverflowException(position);
|
||||
if (equal != null)
|
||||
{
|
||||
if (_places.Contains(plane, equal))
|
||||
throw new ArgumentException(nameof(plane));
|
||||
}
|
||||
return -1;
|
||||
|
||||
_places.Insert(position, plane);
|
||||
return true;
|
||||
return position;
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
@@ -77,15 +69,13 @@ namespace ProjectBomber.Generics
|
||||
public bool Remove(int position)
|
||||
{
|
||||
/// Проверка позиции
|
||||
if (position < 0 || position > _maxCount || position >= Count)
|
||||
throw new BomberNotFoundException(position);
|
||||
/// Удаление объекта из массива, присвоив элементу массива значение null
|
||||
if ((position < 0) || (position > _maxCount)) return false;
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public T? this[int position]
|
||||
@@ -94,16 +84,12 @@ namespace ProjectBomber.Generics
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return null;
|
||||
if (_places.Count <= position)
|
||||
return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return;
|
||||
if (_places.Count <= position)
|
||||
return;
|
||||
_places[position] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
internal class StorageOverflowException : ApplicationException
|
||||
{
|
||||
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { }
|
||||
public StorageOverflowException() : base() { }
|
||||
public StorageOverflowException(string message) : base(message) { }
|
||||
public StorageOverflowException(string message, Exception exception) : base(message, exception) { }
|
||||
protected StorageOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": "Information",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/log_.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Level:u4}[{Timestamp:HH:mm:ss.fff}]: {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
|
||||
"Properties": {
|
||||
"Application": "GasolineTanker"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user