Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41ccf1460c | ||
|
|
585ce78621 | ||
|
|
5f939eb88b |
18
MotorBoat/MotorBoat/BoatNotFoundException.cs
Normal file
18
MotorBoat/MotorBoat/BoatNotFoundException.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MotorBoat
|
||||||
|
{
|
||||||
|
internal class BoatNotFoundException : ApplicationException
|
||||||
|
{
|
||||||
|
public BoatNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
|
||||||
|
public BoatNotFoundException() : base() { }
|
||||||
|
public BoatNotFoundException(string message) : base(message) { }
|
||||||
|
public BoatNotFoundException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected BoatNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -24,11 +25,14 @@ namespace MotorBoat
|
|||||||
}
|
}
|
||||||
public void SetObject(int x, int y, int width, int height)
|
public void SetObject(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
_boat.SetPosition(x, y, width, height);
|
_boat.SetPosition(x, y, width, height);
|
||||||
|
|
||||||
}
|
}
|
||||||
void IDrawningObject.DrawningObject(Graphics g)
|
void IDrawningObject.DrawningObject(Graphics g)
|
||||||
{
|
{
|
||||||
_boat.DrawTransport(g);
|
_boat.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
public string GetInfo() => _boat?.GetDataForSave();
|
||||||
|
public static IDrawningObject Create(string data) => new DrawningObjectBoat(data.CreateDrawningBoat());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
MotorBoat/MotorBoat/ExtentionBoat.cs
Normal file
56
MotorBoat/MotorBoat/ExtentionBoat.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MotorBoat
|
||||||
|
{
|
||||||
|
internal static class ExtentionCar
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи информации по объекту в файл
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForObject = ':';
|
||||||
|
/// <summary>
|
||||||
|
/// Создание объекта из строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DrawningBoat CreateDrawningBoat(this string info)
|
||||||
|
{
|
||||||
|
string[] strs = info.Split(_separatorForObject);
|
||||||
|
if (strs.Length == 3)
|
||||||
|
{
|
||||||
|
return new DrawningBoat(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]), Color.FromName(strs[2]));
|
||||||
|
}
|
||||||
|
if (strs.Length == 7)
|
||||||
|
{
|
||||||
|
return new DrawningMotorBoat(Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]), Color.FromName(strs[2]),
|
||||||
|
Color.FromName(strs[3]), Convert.ToBoolean(strs[4]),
|
||||||
|
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение данных для сохранения в файл
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drawningCar"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDataForSave(this DrawningBoat drawningBoat)
|
||||||
|
{
|
||||||
|
var boat = drawningBoat.Boat;
|
||||||
|
var str =
|
||||||
|
$"{boat.Speed}{_separatorForObject}{boat.Weight}{_separatorForObject}{boat.BodyColor.Name}";
|
||||||
|
if (boat is not EntityMotorBoat motorBoat)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
$"{str}{_separatorForObject}{motorBoat.DopColor.Name}{_separatorForObject}{motorBoat.BodyKit}{_separatorForObject}{motorBoat.Wing}{_separatorForObject}{motorBoat.SportLine}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
77
MotorBoat/MotorBoat/FormMapWithSetBoats.Designer.cs
generated
77
MotorBoat/MotorBoat/FormMapWithSetBoats.Designer.cs
generated
@@ -44,8 +44,15 @@
|
|||||||
this.buttonAddBoat = new System.Windows.Forms.Button();
|
this.buttonAddBoat = new System.Windows.Forms.Button();
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||||
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.groupBoxTools.SuspendLayout();
|
this.groupBoxTools.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||||
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBoxTools
|
// groupBoxTools
|
||||||
@@ -65,9 +72,9 @@
|
|||||||
this.groupBoxTools.Controls.Add(this.buttonAddBoat);
|
this.groupBoxTools.Controls.Add(this.buttonAddBoat);
|
||||||
this.groupBoxTools.Controls.Add(this.comboBoxSelectorMap);
|
this.groupBoxTools.Controls.Add(this.comboBoxSelectorMap);
|
||||||
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.groupBoxTools.Location = new System.Drawing.Point(809, 0);
|
this.groupBoxTools.Location = new System.Drawing.Point(809, 24);
|
||||||
this.groupBoxTools.Name = "groupBoxTools";
|
this.groupBoxTools.Name = "groupBoxTools";
|
||||||
this.groupBoxTools.Size = new System.Drawing.Size(251, 645);
|
this.groupBoxTools.Size = new System.Drawing.Size(251, 621);
|
||||||
this.groupBoxTools.TabIndex = 0;
|
this.groupBoxTools.TabIndex = 0;
|
||||||
this.groupBoxTools.TabStop = false;
|
this.groupBoxTools.TabStop = false;
|
||||||
this.groupBoxTools.Text = "v";
|
this.groupBoxTools.Text = "v";
|
||||||
@@ -143,7 +150,7 @@
|
|||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.BackgroundImage = global::MotorBoat.Properties.Resources.d;
|
this.buttonDown.BackgroundImage = global::MotorBoat.Properties.Resources.d;
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonDown.Location = new System.Drawing.Point(112, 553);
|
this.buttonDown.Location = new System.Drawing.Point(112, 529);
|
||||||
this.buttonDown.Name = "buttonDown";
|
this.buttonDown.Name = "buttonDown";
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonDown.TabIndex = 20;
|
this.buttonDown.TabIndex = 20;
|
||||||
@@ -155,7 +162,7 @@
|
|||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.BackgroundImage = global::MotorBoat.Properties.Resources.up;
|
this.buttonRight.BackgroundImage = global::MotorBoat.Properties.Resources.up;
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonRight.Location = new System.Drawing.Point(148, 553);
|
this.buttonRight.Location = new System.Drawing.Point(148, 529);
|
||||||
this.buttonRight.Name = "buttonRight";
|
this.buttonRight.Name = "buttonRight";
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonRight.TabIndex = 19;
|
this.buttonRight.TabIndex = 19;
|
||||||
@@ -167,7 +174,7 @@
|
|||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.BackgroundImage = global::MotorBoat.Properties.Resources.left;
|
this.buttonLeft.BackgroundImage = global::MotorBoat.Properties.Resources.left;
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(76, 553);
|
this.buttonLeft.Location = new System.Drawing.Point(76, 529);
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonLeft.TabIndex = 18;
|
this.buttonLeft.TabIndex = 18;
|
||||||
@@ -179,7 +186,7 @@
|
|||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.BackgroundImage = global::MotorBoat.Properties.Resources.r;
|
this.buttonUp.BackgroundImage = global::MotorBoat.Properties.Resources.r;
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonUp.Location = new System.Drawing.Point(112, 517);
|
this.buttonUp.Location = new System.Drawing.Point(112, 493);
|
||||||
this.buttonUp.Name = "buttonUp";
|
this.buttonUp.Name = "buttonUp";
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonUp.TabIndex = 17;
|
this.buttonUp.TabIndex = 17;
|
||||||
@@ -223,12 +230,54 @@
|
|||||||
// pictureBox
|
// pictureBox
|
||||||
//
|
//
|
||||||
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
this.pictureBox.Location = new System.Drawing.Point(0, 24);
|
||||||
this.pictureBox.Name = "pictureBox";
|
this.pictureBox.Name = "pictureBox";
|
||||||
this.pictureBox.Size = new System.Drawing.Size(809, 645);
|
this.pictureBox.Size = new System.Drawing.Size(809, 621);
|
||||||
this.pictureBox.TabIndex = 0;
|
this.pictureBox.TabIndex = 0;
|
||||||
this.pictureBox.TabStop = false;
|
this.pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.файлToolStripMenuItem});
|
||||||
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
this.menuStrip1.Size = new System.Drawing.Size(1060, 24);
|
||||||
|
this.menuStrip1.TabIndex = 1;
|
||||||
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// файлToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.SaveToolStripMenuItem,
|
||||||
|
this.LoadToolStripMenuItem});
|
||||||
|
this.файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||||
|
this.файлToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||||
|
this.файлToolStripMenuItem.Text = "Файл";
|
||||||
|
//
|
||||||
|
// SaveToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||||
|
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.SaveToolStripMenuItem.Text = "Сохранение";
|
||||||
|
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// LoadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||||
|
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.LoadToolStripMenuItem.Text = "Загрузка";
|
||||||
|
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// openFileDialog
|
||||||
|
//
|
||||||
|
this.openFileDialog.FileName = "openFileDialog1";
|
||||||
|
this.openFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
this.saveFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
// FormMapWithSetBoats
|
// FormMapWithSetBoats
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
@@ -236,12 +285,16 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(1060, 645);
|
this.ClientSize = new System.Drawing.Size(1060, 645);
|
||||||
this.Controls.Add(this.pictureBox);
|
this.Controls.Add(this.pictureBox);
|
||||||
this.Controls.Add(this.groupBoxTools);
|
this.Controls.Add(this.groupBoxTools);
|
||||||
|
this.Controls.Add(this.menuStrip1);
|
||||||
this.Name = "FormMapWithSetBoats";
|
this.Name = "FormMapWithSetBoats";
|
||||||
this.Text = "Лодка";
|
this.Text = "FormMapWithSetBoats";
|
||||||
this.groupBoxTools.ResumeLayout(false);
|
this.groupBoxTools.ResumeLayout(false);
|
||||||
this.groupBoxTools.PerformLayout();
|
this.groupBoxTools.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||||
|
this.menuStrip1.ResumeLayout(false);
|
||||||
|
this.menuStrip1.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,5 +316,11 @@
|
|||||||
private ListBox ListBoxMaps;
|
private ListBox ListBoxMaps;
|
||||||
private Button ButtonAddMap;
|
private Button ButtonAddMap;
|
||||||
private TextBox textBoxNewMapName;
|
private TextBox textBoxNewMapName;
|
||||||
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem файлToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
|
private OpenFileDialog openFileDialog;
|
||||||
|
private SaveFileDialog saveFileDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -23,12 +24,14 @@ namespace MotorBoat
|
|||||||
{"Морская карта",new SeaMap() }
|
{"Морская карта",new SeaMap() }
|
||||||
};
|
};
|
||||||
private readonly MapsCollection _mapsCollection;
|
private readonly MapsCollection _mapsCollection;
|
||||||
|
private readonly ILogger _logger;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormMapWithSetBoats()
|
public FormMapWithSetBoats(ILogger<FormMapWithSetBoats> logger)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
|
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
|
||||||
comboBoxSelectorMap.Items.Clear();
|
comboBoxSelectorMap.Items.Clear();
|
||||||
foreach (var elem in _mapDict)
|
foreach (var elem in _mapDict)
|
||||||
@@ -104,21 +107,32 @@ namespace MotorBoat
|
|||||||
|
|
||||||
public void AddBoat(DrawningBoat boat)
|
public void AddBoat(DrawningBoat boat)
|
||||||
{
|
{
|
||||||
if (ListBoxMaps.SelectedIndex == -1)
|
try
|
||||||
{
|
{
|
||||||
return;
|
if (ListBoxMaps.SelectedIndex == -1)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectBoat(boat) != -1)
|
if (_mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectBoat(boat) != -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
MessageBox.Show("Объект добавлен");
|
||||||
|
_logger.LogInformation("Добавлен объект {@Boat}", boat);
|
||||||
|
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
_logger.LogWarning("Не удалось добавить объект");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (StorageOverflowException ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить");
|
_logger.LogWarning("Ошибка, переполнение хранилища :{0}", ex.Message);
|
||||||
|
MessageBox.Show($"Ошибка хранилище переполнено: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта
|
/// Удаление объекта
|
||||||
@@ -140,14 +154,30 @@ namespace MotorBoat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
try
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
var boatForDel = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos;
|
||||||
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
if (boatForDel != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
_logger.LogInformation("Из текущей карты удалён объект {@Boat}", boatForDel);
|
||||||
|
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Не удалось удалить объект по позиции {0}. Объект равен null", pos);
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (BoatNotFoundException ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
_logger.LogWarning("Ошибка удаления: {0}", ex.Message);
|
||||||
|
MessageBox.Show($"Ошибка удаления: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Неизвестная ошибка удаления: {0}", ex.Message);
|
||||||
|
MessageBox.Show($"Неизвестная ошибка: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -213,19 +243,23 @@ namespace MotorBoat
|
|||||||
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("При добавлении карты {0}", comboBoxSelectorMap.SelectedIndex == -1 ? "Не была выбрана карта" : "Не была названа карта");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_mapDict.ContainsKey(comboBoxSelectorMap.Text))
|
if (!_mapDict.ContainsKey(comboBoxSelectorMap.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Отсутствует карта с типом {0}", comboBoxSelectorMap.Text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapDict[comboBoxSelectorMap.Text]);
|
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapDict[comboBoxSelectorMap.Text]);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
|
_logger.LogInformation($"Добавлена карта: {textBoxNewMapName.Text}");
|
||||||
}
|
}
|
||||||
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
_logger.LogInformation("Осуществлён переход на карту под названием {0}", ListBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
@@ -236,10 +270,50 @@ namespace MotorBoat
|
|||||||
}
|
}
|
||||||
if (MessageBox.Show($"Удалить карту {ListBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show($"Удалить карту {ListBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
|
_logger.LogInformation("Удалена карта {0}", ListBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
_mapsCollection.DelMap(ListBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
_mapsCollection.DelMap(ListBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mapsCollection.SaveData(saveFileDialog.FileName);
|
||||||
|
_logger.LogInformation("Сохранение прошло успешно. Расположение файла: {0}", saveFileDialog.FileName);
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Не удалось сохранить файл '{0}'. Текст ошибки: {1}", saveFileDialog.FileName, ex.Message);
|
||||||
|
MessageBox.Show("Не сохранилось", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mapsCollection.LoadData(openFileDialog.FileName);
|
||||||
|
_logger.LogInformation("Загрузка данных из файла '{0}' прошла успешно", openFileDialog.FileName);
|
||||||
|
ReloadMaps();
|
||||||
|
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Не удалось загрузить файл '{0}'. Текст ошибки: {1}", openFileDialog.FileName, ex.Message);
|
||||||
|
MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,4 +57,13 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>14, 13</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>129, 13</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>269, 13</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
@@ -36,5 +36,9 @@ namespace MotorBoat
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||||
|
/// Получение информации по объекту
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GetInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
{
|
{
|
||||||
int width = picWidth / _placeSizeWidth;
|
int width = picWidth / _placeSizeWidth;
|
||||||
int height = picHeight / _placeSizeHeight;
|
int height = picHeight / _placeSizeHeight;
|
||||||
_setBoats = new SetBoatsGeneric<T>(width * height);
|
_setBoats = new SetBoatsGeneric<T>(21);
|
||||||
_pictureWidth = picWidth;
|
_pictureWidth = picWidth;
|
||||||
_pictureHeight = picHeight;
|
_pictureHeight = picHeight;
|
||||||
_map = map;
|
_map = map;
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
/// Перегрузка оператора сложения
|
/// Перегрузка оператора сложения
|
||||||
public static int operator +(MapWithSetBoatsGeneric<T, U> map, T boat)
|
public static int operator +(MapWithSetBoatsGeneric<T, U> map, T boat)
|
||||||
{
|
{
|
||||||
|
|
||||||
return map._setBoats.Insert(boat);
|
return map._setBoats.Insert(boat);
|
||||||
}
|
}
|
||||||
/// Перегрузка оператора вычитания
|
/// Перегрузка оператора вычитания
|
||||||
@@ -163,5 +164,22 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string GetData(char separatorType, char separatorData)
|
||||||
|
{
|
||||||
|
string data = $"{_map.GetType().Name}{separatorType}";
|
||||||
|
foreach (var boat in _setBoats.GetBoat())
|
||||||
|
{
|
||||||
|
data += $"{boat.GetInfo()}{separatorData}";
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public void LoadData(string[] records)
|
||||||
|
{
|
||||||
|
foreach (var rec in records)
|
||||||
|
{
|
||||||
|
_setBoats.Insert(DrawningObjectBoat.Create(rec) as T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,13 +8,16 @@ namespace MotorBoat
|
|||||||
{
|
{
|
||||||
internal class MapsCollection
|
internal class MapsCollection
|
||||||
{
|
{
|
||||||
readonly Dictionary<string, MapWithSetBoatsGeneric<DrawningObjectBoat, AbstractMap>> _mapStorages;
|
|
||||||
|
readonly Dictionary<string, MapWithSetBoatsGeneric<IDrawningObject, AbstractMap>> _mapStorages;
|
||||||
public List<string> Keys => _mapStorages.Keys.ToList();
|
public List<string> Keys => _mapStorages.Keys.ToList();
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
|
private readonly char separatorDict = '|';
|
||||||
|
private readonly char separatorData = ';';
|
||||||
public MapsCollection(int pictureWidth, int pictureHeight)
|
public MapsCollection(int pictureWidth, int pictureHeight)
|
||||||
{
|
{
|
||||||
_mapStorages = new Dictionary<string, MapWithSetBoatsGeneric<DrawningObjectBoat, AbstractMap>>();
|
_mapStorages = new Dictionary<string, MapWithSetBoatsGeneric<IDrawningObject, AbstractMap>>();
|
||||||
_pictureWidth = pictureWidth;
|
_pictureWidth = pictureWidth;
|
||||||
_pictureHeight = pictureHeight;
|
_pictureHeight = pictureHeight;
|
||||||
}
|
}
|
||||||
@@ -22,14 +25,14 @@ namespace MotorBoat
|
|||||||
{
|
{
|
||||||
if (!_mapStorages.ContainsKey(name))
|
if (!_mapStorages.ContainsKey(name))
|
||||||
{
|
{
|
||||||
_mapStorages.Add(name, new MapWithSetBoatsGeneric<DrawningObjectBoat, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
_mapStorages.Add(name, new MapWithSetBoatsGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void DelMap(string name)
|
public void DelMap(string name)
|
||||||
{
|
{
|
||||||
if (_mapStorages.ContainsKey(name)) _mapStorages.Remove(name);
|
if (_mapStorages.ContainsKey(name)) _mapStorages.Remove(name);
|
||||||
}
|
}
|
||||||
public MapWithSetBoatsGeneric<DrawningObjectBoat, AbstractMap> this[string ind]
|
public MapWithSetBoatsGeneric<IDrawningObject, AbstractMap> this[string ind]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -40,5 +43,59 @@ namespace MotorBoat
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
using (StreamWriter fs = new StreamWriter(filename))
|
||||||
|
{
|
||||||
|
fs.Write($"MapsCollection{Environment.NewLine}");
|
||||||
|
foreach (var storage in _mapStorages)
|
||||||
|
{
|
||||||
|
|
||||||
|
fs.Write($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}{Environment.NewLine}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException("Файл не найден");
|
||||||
|
}
|
||||||
|
string str = "";
|
||||||
|
using (StreamReader fs = new StreamReader(filename))
|
||||||
|
{
|
||||||
|
str = fs.ReadLine();
|
||||||
|
if (!str.Contains("MapsCollection"))
|
||||||
|
{
|
||||||
|
throw new FileFormatException("Формат данных в файле не правильный");
|
||||||
|
}
|
||||||
|
_mapStorages.Clear();
|
||||||
|
while ((str = fs.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
var elem = str.Split(separatorDict);
|
||||||
|
AbstractMap map = null;
|
||||||
|
switch (elem[1])
|
||||||
|
{
|
||||||
|
case "SimpleMap":
|
||||||
|
map = new SimpleMap();
|
||||||
|
break;
|
||||||
|
case "PinkMap":
|
||||||
|
map = new PinkMap();
|
||||||
|
break;
|
||||||
|
case "SeaMap":
|
||||||
|
map = new SeaMap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_mapStorages.Add(elem[0], new MapWithSetBoatsGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
|
_mapStorages[elem[0]].LoadData(elem[2].Split(separatorData,StringSplitOptions.RemoveEmptyEntries));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,18 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.AppSettings" Version="2.2.2" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.InfluxDBv2" Version="1.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace MotorBoat
|
namespace MotorBoat
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@@ -11,7 +16,27 @@ namespace MotorBoat
|
|||||||
// 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 FormMapWithSetBoats());
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
|
||||||
|
{
|
||||||
|
Application.Run(serviceProvider.GetRequiredService<FormMapWithSetBoats>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<FormMapWithSetBoats>()
|
||||||
|
.AddLogging(option =>
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile(path: "appSetting.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
var logger = new LoggerConfiguration().ReadFrom.Configuration(configuration)
|
||||||
|
.WriteTo.RollingFile("Logs\\log.txt")
|
||||||
|
.CreateLogger();
|
||||||
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
|
option.AddSerilog(logger);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,14 +27,15 @@ namespace MotorBoat
|
|||||||
}
|
}
|
||||||
public int Insert(T boat, int position)
|
public int Insert(T boat, int position)
|
||||||
{
|
{
|
||||||
if (position >= _maxCount || position < 0) return -1;
|
if (Count == _maxCount) { throw new StorageOverflowException(_maxCount); }
|
||||||
|
if (position > _maxCount || position < 0) return -1;
|
||||||
_places.Insert(position, boat);
|
_places.Insert(position, boat);
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
public T Remove(int position)
|
public T Remove(int position)
|
||||||
{
|
{
|
||||||
// TODO проверка позиции
|
// TODO проверка позиции
|
||||||
if (position >= _maxCount || position < 0) return null;
|
if (position >= Count || position < 0) throw new BoatNotFoundException(position);
|
||||||
// TODO удаление объекта из массива, присовив элементу массива значение null
|
// TODO удаление объекта из массива, присовив элементу массива значение null
|
||||||
T temp = _places[position];
|
T temp = _places[position];
|
||||||
_places.RemoveAt(position);
|
_places.RemoveAt(position);
|
||||||
|
|||||||
19
MotorBoat/MotorBoat/StorageOverflowException.cs
Normal file
19
MotorBoat/MotorBoat/StorageOverflowException.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MotorBoat
|
||||||
|
{
|
||||||
|
[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 context) : base(info, context) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
MotorBoat/MotorBoat/appSetting.json
Normal file
19
MotorBoat/MotorBoat/appSetting.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Information",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "MotorBoat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user