Youdakova D.R. PIbd-21 LabWork07 #7

Closed
Daniya_Youdakova wants to merge 6 commits from LabWork07 into LabWork06
4 changed files with 61 additions and 0 deletions
Showing only changes of commit 973ec5d31c - Show all commits

View File

@ -70,6 +70,7 @@ namespace AircraftCarrier
yNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_y);
xObjOffset = (int)(Left / _size_x);
yObjOffset = (int)Math.Ceiling(Bottom / _size_y);
for (int i = 0; i < yNumOfCells; i++)
{
if (!roadIsClear)
@ -90,6 +91,7 @@ namespace AircraftCarrier
}
}
break;
case Direction.Left:
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
@ -116,6 +118,7 @@ namespace AircraftCarrier
}
}
break;
case Direction.Right:
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
@ -162,6 +165,7 @@ namespace AircraftCarrier
int yNumOfCells = (int)Math.Ceiling(Bottom / _size_y) - (int)Math.Floor(Top / _size_y);
int xObjOffset = (int)(x / _size_x);
int yObjOffset = (int)(y / _size_y);
while (y < _height - (Bottom - Top))
{
while (x < _width - (Right - Left))

View File

@ -8,6 +8,29 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace AircraftCarrier
{
[Serializable]
internal class AircraftCarrierNotFoundException: ApplicationException
{
public AircraftCarrierNotFoundException(int i) : base($"Не найден объект по позиции{ i}") { }
public AircraftCarrierNotFoundException() : base() { }
public AircraftCarrierNotFoundException(string message) : base(message) { }
public AircraftCarrierNotFoundException(string message, Exception exception) : base(message, exception)
{ }
protected AircraftCarrierNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
}
}

View File

@ -0,0 +1,14 @@
{
"Serilog": {
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "./Logs/program_log.log",
"formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact",
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}] {Level:u4}: {Message:lj}{NewLine}{Exception}"
}
}
]
}
}