From 30ad241b99f7a4c25007e7847c099053d83f8f0a Mon Sep 17 00:00:00 2001 From: ker73rus Date: Tue, 29 Nov 2022 10:54:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Stormtrooper/Stormtrooper/Program.cs | 5 +++-- .../Stormtrooper/SetAirplaneGeneric.cs | 6 +++--- Stormtrooper/Stormtrooper/Stormtrooper.csproj | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Stormtrooper/Stormtrooper/Program.cs b/Stormtrooper/Stormtrooper/Program.cs index 50685ff..d2bef84 100644 --- a/Stormtrooper/Stormtrooper/Program.cs +++ b/Stormtrooper/Stormtrooper/Program.cs @@ -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); diff --git a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs index 04001c0..90a54e1 100644 --- a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs +++ b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs @@ -34,8 +34,8 @@ namespace Stormtrooper /// 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; } /// diff --git a/Stormtrooper/Stormtrooper/Stormtrooper.csproj b/Stormtrooper/Stormtrooper/Stormtrooper.csproj index 30817a2..627cd34 100644 --- a/Stormtrooper/Stormtrooper/Stormtrooper.csproj +++ b/Stormtrooper/Stormtrooper/Stormtrooper.csproj @@ -8,13 +8,30 @@ enable + + + + + + + Always + + + + + + + + + + @@ -23,4 +40,6 @@ + + \ No newline at end of file