лаб-7
This commit is contained in:
parent
910cc861f9
commit
973ec5d31c
@ -70,6 +70,7 @@ namespace AircraftCarrier
|
|||||||
yNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_y);
|
yNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_y);
|
||||||
xObjOffset = (int)(Left / _size_x);
|
xObjOffset = (int)(Left / _size_x);
|
||||||
yObjOffset = (int)Math.Ceiling(Bottom / _size_y);
|
yObjOffset = (int)Math.Ceiling(Bottom / _size_y);
|
||||||
|
|
||||||
for (int i = 0; i < yNumOfCells; i++)
|
for (int i = 0; i < yNumOfCells; i++)
|
||||||
{
|
{
|
||||||
if (!roadIsClear)
|
if (!roadIsClear)
|
||||||
@ -90,6 +91,7 @@ namespace AircraftCarrier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Direction.Left:
|
case Direction.Left:
|
||||||
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
||||||
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
|
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
|
||||||
@ -116,6 +118,7 @@ namespace AircraftCarrier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Direction.Right:
|
case Direction.Right:
|
||||||
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
||||||
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
|
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 yNumOfCells = (int)Math.Ceiling(Bottom / _size_y) - (int)Math.Floor(Top / _size_y);
|
||||||
int xObjOffset = (int)(x / _size_x);
|
int xObjOffset = (int)(x / _size_x);
|
||||||
int yObjOffset = (int)(y / _size_y);
|
int yObjOffset = (int)(y / _size_y);
|
||||||
|
|
||||||
while (y < _height - (Bottom - Top))
|
while (y < _height - (Bottom - Top))
|
||||||
{
|
{
|
||||||
while (x < _width - (Right - Left))
|
while (x < _width - (Right - Left))
|
||||||
|
@ -8,6 +8,29 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</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>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
@ -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) { }
|
||||||
|
}
|
||||||
|
}
|
14
AircraftCarrier/AircraftCarrier/appsettings.json
Normal file
14
AircraftCarrier/AircraftCarrier/appsettings.json
Normal 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}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user