Compare commits

..

No commits in common. "e4d751e638c6e54565c8f4370dbc2e1579bd67dd" and "ea555cc89719b619e6234fee39543348883c3344" have entirely different histories.

6 changed files with 13 additions and 48 deletions

View File

@ -30,7 +30,7 @@ namespace HoistingCrane.CollectionGenericObjects
{
get
{
return (pictureWidth / _placeSizeWidth) * (pictureHeight / _placeSizeHeight);
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth)-2;
}
}
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)

View File

@ -44,7 +44,7 @@ namespace HoistingCrane
else
{
MessageBox.Show("Не удалось добавить объект");
logger.LogInformation("Не удалось добавить кран {crane} в коллекцию", drawningTrackedVehicle.GetType().Name);
logger.LogInformation("Не удалось добавить корабль {ship} в коллекцию", drawningTrackedVehicle.GetType().Name);
}
}
catch (CollectionOverflowException ex)
@ -142,12 +142,12 @@ namespace HoistingCrane
if (radioButtonMassive.Checked)
{
collectionType = CollectionType.Massive;
logger.LogInformation("Создана коллекция {nameCol} , название: {name}", collectionType, textBoxCollectionName.Text);
logger.LogInformation("Создана коллекция '{nameCol}' , название: {name}", collectionType, textBoxCollectionName.Text);
}
else if (radioButtonList.Checked)
{
collectionType = CollectionType.List;
logger.LogInformation("Создана коллекция {nameCol} , название: {name}", collectionType, textBoxCollectionName.Text);
logger.LogInformation("Создана коллекция '{nameCol}' , название: {name}", collectionType, textBoxCollectionName.Text);
}
_storageCollection.AddCollection(textBoxCollectionName.Text,collectionType);RerfreshListBoxItems();
}
@ -205,7 +205,7 @@ namespace HoistingCrane
{
_storageCollection.SaveData(saveFileDialog.FileName);
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
logger.LogInformation("Сохранение в файл: {filename}", saveFileDialog.FileName.ToString());
logger.LogInformation("Сохранение в файл: {filename}", saveFileDialog.FileName);
}
catch (Exception ex)
{
@ -229,7 +229,7 @@ namespace HoistingCrane
_storageCollection.LoadData(openFileDialog.FileName);
RerfreshListBoxItems();
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
logger.LogInformation("Загрузка из файла: {filename}", saveFileDialog.FileName.ToString());
logger.LogInformation("Загрузка в файл: {filename}", saveFileDialog.FileName);
}
catch(Exception ex)
{

View File

@ -13,11 +13,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" 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="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.9" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />

View File

@ -1,7 +1,8 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Extensions.Logging;
namespace HoistingCrane
{
internal static class Program
@ -17,24 +18,11 @@ namespace HoistingCrane
}
private static void ConfigureServices(ServiceCollection services)
{
string[] path = Directory.GetCurrentDirectory().Split('\\');
string pathNeed = "";
for (int i = 0; i < path.Length - 3; i++)
// Èíèöèàëèçèðóåì Serilog
Log.Logger = new LoggerConfiguration().WriteTo.File("E:\\myLog.log").CreateLogger();
services.AddSingleton<FormCarCollection>().AddLogging(builder =>
{
pathNeed += path[i] + "\\";
}
services.AddSingleton<FormCarCollection>()
.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddSerilog(new LoggerConfiguration()
.ReadFrom.Configuration(new ConfigurationBuilder()
.AddJsonFile($"{pathNeed}serilog.json")
.Build())
.CreateLogger());
builder.AddSerilog();
});
}
}

View File

@ -1,18 +0,0 @@

{
"Serilog": {
"Using": [ "Serilog.Sinks.File" ],
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log.log"
}
}
],
"Properties": {
"Application": "Sample"
}
}
}

View File

@ -1,2 +0,0 @@
CollectionsStorage
массив|Massive|25|EntityTrackedVehicle:100:100:White;EntityTrackedVehicle:100:100:Yellow;EntityTrackedVehicle:100:100:Purple;EntityHoistingCrane:100:100:Gray:Black:True:False;EntityTrackedVehicle:100:100:White;EntityTrackedVehicle:100:100:White;EntityHoistingCrane:100:100:Green:Black:False:False;EntityTrackedVehicle:100:100:Gray;EntityTrackedVehicle:100:100:Red;EntityHoistingCrane:100:100:White:Black:False:False;EntityHoistingCrane:100:100:Green:Blue:True:False;EntityHoistingCrane:100:100:Black:Black:True:True;EntityTrackedVehicle:100:100:White;EntityTrackedVehicle:100:100:Purple;EntityTrackedVehicle:100:100:Black;EntityTrackedVehicle:100:100:Blue;EntityTrackedVehicle:100:100:Gray;EntityTrackedVehicle:100:100:Red;EntityTrackedVehicle:100:100:Purple;EntityTrackedVehicle:100:100:Green;EntityTrackedVehicle:100:100:Purple;EntityTrackedVehicle:100:100:Yellow;EntityTrackedVehicle:100:100:Blue;EntityTrackedVehicle:100:100:Gray;