готово

This commit is contained in:
ker73rus 2022-11-29 10:54:21 +04:00
parent 0a5fc475d2
commit 30ad241b99
3 changed files with 25 additions and 5 deletions

View File

@ -30,11 +30,12 @@ namespace Stormtrooper
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(path: "appSettings.json", optional: false, reloadOnChange: true)
.AddJsonFile(path: "appSetting.json", optional: false, reloadOnChange: true)
.Build();
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration);
.ReadFrom.Configuration(configuration)
.CreateLogger();
option.SetMinimumLevel(LogLevel.Information);
option.AddSerilog(logger);

View File

@ -34,8 +34,8 @@ namespace Stormtrooper
/// <returns></returns>
public int Insert(T airplane)
{
if (Count == _maxCount)
return -1;
if (Count >= _maxCount)
throw new StorageOverflowException(_maxCount);
Insert(airplane, 0);
return 0;
}
@ -63,7 +63,7 @@ namespace Stormtrooper
if (Count == 0 || position < 0 || position >= _maxCount)
throw new AirplaneNotFoundException(position);
T air = _places[position];
_places[position] = null;
_places.RemoveAt(position);
return air;
}
/// <summary>

View File

@ -8,13 +8,30 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="appSetting.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appSetting.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" 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.DependencyInjection.Abstractions" 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="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
@ -23,4 +40,6 @@
</Compile>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project>