Слетевшая 7 лаба готова

This commit is contained in:
Ctepa 2024-05-20 04:55:35 +03:00
parent 72081a1e24
commit beb7bdf552
3 changed files with 18 additions and 14 deletions

View File

@ -13,11 +13,9 @@
<PackageReference Include="EntityFramework.ru" Version="6.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>

View File

@ -86,8 +86,11 @@ public abstract class AbstractCompany
SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
{
DrawningGun? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
try
{
DrawningGun? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}catch(Exception ) { }
}
return bitmap;
}

View File

@ -45,19 +45,22 @@ public class GunSharingService : AbstractCompany
int boarderOffsetY = 10;
int currentIndex = -1;
for (int j = 0; j < maxCountY; j++)
try
{
for (int i = 0; i < maxCountX; i++)
for (int j = 0; j < maxCountY; j++)
{
currentIndex++;
if (_collection.Get(currentIndex) != null)
for (int i = 0; i < maxCountX; i++)
{
currentIndex++;
if (_collection.Get(currentIndex) != null)
{
_collection.Get(currentIndex).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(currentIndex).SetPosition(boarderOffsetX + i * _placeSizeWidth + i * offsetX, boarderOffsetY + j * _placeSizeHeight);
_collection.Get(currentIndex).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(currentIndex).SetPosition(boarderOffsetX + i * _placeSizeWidth + i * offsetX, boarderOffsetY + j * _placeSizeHeight);
}
}
}
}
}catch (Exception ) { }
}
}