From c5cb6097e6a640e7a1732225c92130d4f5693199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Sat, 19 Nov 2022 16:02:58 +0400 Subject: [PATCH 1/4] LabWork7 Complete --- .../AirplaneNotFoundException.cs | 19 ++++ .../AirplaneWithRadar.csproj | 20 ++++ .../FormMapWithSetAirplanes.cs | 105 +++++++++++++----- .../AirplaneWithRadar/MapsCollection.cs | 10 +- .../AirplaneWithRadar/Program.cs | 31 +++++- .../AirplaneWithRadar/SetAirplanesGeneric.cs | 13 ++- .../StorageOverflowException.cs | 14 +++ .../AirplaneWithRadar/appsettings.json | 16 +++ 8 files changed, 192 insertions(+), 36 deletions(-) create mode 100644 AirplaneWithRadar/AirplaneWithRadar/AirplaneNotFoundException.cs create mode 100644 AirplaneWithRadar/AirplaneWithRadar/StorageOverflowException.cs create mode 100644 AirplaneWithRadar/AirplaneWithRadar/appsettings.json diff --git a/AirplaneWithRadar/AirplaneWithRadar/AirplaneNotFoundException.cs b/AirplaneWithRadar/AirplaneWithRadar/AirplaneNotFoundException.cs new file mode 100644 index 0000000..dda84ba --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/AirplaneNotFoundException.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace AirplaneWithRadar +{ + [Serializable] + internal class AirplaneNotFoundException : ApplicationException + { + public AirplaneNotFoundException(int i) : base($"Не найден объект по позиции {i}") { } + public AirplaneNotFoundException() : base() { } + public AirplaneNotFoundException(string message) : base(message) { } + public AirplaneNotFoundException(string message, Exception exception) : base(message, exception) { } + protected AirplaneNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } + } +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj index 13ee123..24dda2e 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj +++ b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj @@ -8,6 +8,20 @@ enable + + + + + + + + + + + + + + True @@ -23,4 +37,10 @@ + + + Always + + + \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs index 220f7a3..f661403 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.cs @@ -1,4 +1,6 @@ -namespace AirplaneWithRadar +using Microsoft.Extensions.Logging; + +namespace AirplaneWithRadar { public partial class FormMapWithSetAirplanes : Form { @@ -17,10 +19,18 @@ /// /// Конструктор /// - public FormMapWithSetAirplanes() + /// + /// Логер + /// + private readonly ILogger _logger; + /// + /// Конструктор + /// + public FormMapWithSetAirplanes(ILogger logger) { InitializeComponent(); _mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height); + _logger = logger; comboBoxSelectorMap.Items.Clear(); foreach (var elem in _mapsDict) { @@ -60,15 +70,18 @@ if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text)) { MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogInformation("При добавлении карты {0}", comboBoxSelectorMap.SelectedIndex == -1 ? "Не была выбрана карта" : "Не была названа карта"); return; } if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text)) { MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogWarning("Нет карты с названием: {0}", textBoxNewMapName.Text); return; } _mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]); ReloadMaps(); + _logger.LogInformation("Добавлена карта {0}", textBoxNewMapName.Text); } /// /// Выбор карты @@ -78,6 +91,7 @@ private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e) { pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + _logger.LogInformation("Осуществлен переход на карту {0}", listBoxMaps.SelectedItem?.ToString() ?? string.Empty); } /// /// Удаление карты @@ -94,6 +108,7 @@ if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty); + _logger.LogInformation("Удалена карта {0}", listBoxMaps.SelectedItem?.ToString() ?? string.Empty); ReloadMaps(); } } @@ -116,18 +131,28 @@ /// private void AddAirplane(DrawningAirplane airplane) { - if (listBoxMaps.SelectedIndex == -1) + try { - MessageBox.Show("Перед добавлением объекта необходимо создать карту"); + if (listBoxMaps.SelectedIndex == -1) + { + MessageBox.Show("Перед добавлением объекта необходимо создать карту"); + } + else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectAirplane(airplane) != -1) + { + MessageBox.Show("Объект добавлен"); + _logger.LogInformation("Добавлен объект {@Airplane}", airplane); + pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + _logger.LogInformation("Не удалось добавить объект"); + } } - else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectAirplane(airplane) != -1) + catch (StorageOverflowException ex) { - MessageBox.Show("Объект добавлен"); - pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); - } - else - { - MessageBox.Show("Не удалось добавить объект"); + _logger.LogWarning("Ошибка переполнения хранилища: {0}", ex.Message); + MessageBox.Show($"Ошибка переполнения хранилища: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); } } /// @@ -137,21 +162,45 @@ /// private void ButtonRemoveAirplane_Click(object sender, EventArgs e) { - if (listBoxMaps.SelectedIndex == -1 || string.IsNullOrEmpty(maskedTextBoxPosition.Text) || - MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + if (listBoxMaps.SelectedIndex == -1) + { + return; + } + if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) + { + return; + } + if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } int pos = Convert.ToInt32(maskedTextBoxPosition.Text); - if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null) + try { - MessageBox.Show("Объект удален"); - pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + var deletedAirplane = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos; + if (deletedAirplane != null) + { + MessageBox.Show("Объект удален"); + _logger.LogInformation("Из текущей карты удален объект {@Airplane}", deletedAirplane); + pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + else + { + _logger.LogInformation("Не удалось добавить объект по позиции {0} равен null", pos); + MessageBox.Show("Не удалось удалить объект"); + } } - else + catch (AirplaneNotFoundException ex) { - MessageBox.Show("Не удалось удалить объект"); + _logger.LogWarning("Ошибка удаления: {0}", ex.Message); + MessageBox.Show($"Ошибка удаления: {ex.Message}"); } + catch (Exception ex) + { + _logger.LogWarning("Неизвестная ошибка", ex.Message); + MessageBox.Show($"Неизвестная ошибка: {ex.Message}"); + } + } /// /// Вывод набора @@ -215,13 +264,16 @@ { if (saveFileDialog.ShowDialog() == DialogResult.OK) { - if (_mapsCollection.SaveData(saveFileDialog.FileName)) + try { + _mapsCollection.SaveData(saveFileDialog.FileName); MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _logger.LogInformation("Сохранение прошло успешно. Файл находится: {0}", saveFileDialog.FileName); } - else + catch (Exception ex) { - MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogWarning("Не удалось сохранить файл '{0}'. Текст ошибки: {1}", saveFileDialog.FileName, ex.Message); } } } @@ -230,14 +282,17 @@ { if (openFileDialog.ShowDialog() == DialogResult.OK) { - if (_mapsCollection.LoadData(openFileDialog.FileName)) + try { - MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _mapsCollection.LoadData(openFileDialog.FileName); + MessageBox.Show("Открытие прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _logger.LogInformation("Открытие файла '{0}' прошло успешно", openFileDialog.FileName); ReloadMaps(); } - else + catch (Exception ex) { - MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show($"Не удалось открыть: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogWarning("Не удалось открыть файл {0}. Текст ошибки: {1}", openFileDialog.FileName, ex.Message); } } } diff --git a/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs b/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs index 3ff0150..caf8518 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs @@ -89,7 +89,7 @@ namespace AirplaneWithRadar /// /// Путь и имя файла /// - public bool SaveData(string filename) + public void SaveData(string filename) { if (File.Exists(filename)) { @@ -103,25 +103,24 @@ namespace AirplaneWithRadar fs.Write($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}{Environment.NewLine}"); } } - return true; } /// /// Загрузка нформации по автомобилям на парковках из файла /// /// /// - public bool LoadData(string filename) + public void LoadData(string filename) { if (!File.Exists(filename)) { - return false; + throw new Exception("Файл не найден"); } using (StreamReader fs = new(filename)) { if (!fs.ReadLine().Contains("MapsCollection")) { //если нет такой записи, то это не те данные - return false; + throw new FileFormatException("Формат данных в файле не правильный"); } //очищаем записи _mapStorages.Clear(); @@ -142,7 +141,6 @@ namespace AirplaneWithRadar _mapStorages[elem[0]].LoadData(elem[2].Split(separatorData, StringSplitOptions.RemoveEmptyEntries)); } } - return true; } } } diff --git a/AirplaneWithRadar/AirplaneWithRadar/Program.cs b/AirplaneWithRadar/AirplaneWithRadar/Program.cs index f9ad494..e1052a1 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/Program.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/Program.cs @@ -1,3 +1,8 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Serilog; + namespace AirplaneWithRadar { internal static class Program @@ -11,7 +16,31 @@ namespace AirplaneWithRadar // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormMapWithSetAirplanes()); + var services = new ServiceCollection(); + ConfigureServices(services); + using (ServiceProvider serviceProvider = services.BuildServiceProvider()) + { + Application.Run(serviceProvider.GetRequiredService()); + } + } + + private static void ConfigureServices(ServiceCollection services) + { + services.AddSingleton() + .AddLogging(option => + { + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true) + .Build(); + + var logger = new LoggerConfiguration() + .ReadFrom.Configuration(configuration) + .CreateLogger(); + + option.SetMinimumLevel(LogLevel.Information); + option.AddSerilog(logger); + }); } } } \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs b/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs index 5b0396c..f946680 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs @@ -46,13 +46,15 @@ /// Добавляемый самолет /// Позиция /// - public int Insert(T airplane, int position) + public int Insert(T warplane, int position) { + if (Count == _maxCount) + throw new StorageOverflowException(_maxCount); if (!isCorrectPosition(position)) { return -1; } - _places.Insert(position, airplane); + _places.Insert(position, warplane); return position; } /// @@ -62,8 +64,11 @@ /// public T Remove(int position) { - if (!isCorrectPosition(position)) return null; - var result = _places[position]; + if (!isCorrectPosition(position)) + return null; + var result = this[position]; + if (result == null) + throw new AirplaneNotFoundException(position); _places.RemoveAt(position); return result; } diff --git a/AirplaneWithRadar/AirplaneWithRadar/StorageOverflowException.cs b/AirplaneWithRadar/AirplaneWithRadar/StorageOverflowException.cs new file mode 100644 index 0000000..45772d8 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/StorageOverflowException.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; + +namespace AirplaneWithRadar +{ + [Serializable] + internal class StorageOverflowException : ApplicationException + { + public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { } + public StorageOverflowException() : base() { } + public StorageOverflowException(string message) : base(message) { } + public StorageOverflowException(string message, Exception exception) : base(message, exception) { } + protected StorageOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } + } +} diff --git a/AirplaneWithRadar/AirplaneWithRadar/appsettings.json b/AirplaneWithRadar/AirplaneWithRadar/appsettings.json new file mode 100644 index 0000000..6e66299 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/appsettings.json @@ -0,0 +1,16 @@ +{ + "Serilog": { + "Using": [ "Serilog.Sinks.File" ], + "MinimumLevel": "Information", + "WriteTo": [ + { + "Name": "File", + "Args": { + "path": "Logs/log_.log", + "rollingInterval": "Day", + "outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}" + } + } + ] + } +} \ No newline at end of file -- 2.25.1 From d1bc83d5475afdbd37c3aeb2e506e3208f500bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Sat, 19 Nov 2022 16:09:52 +0400 Subject: [PATCH 2/4] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D0=B0=20?= =?UTF-8?q?=D0=BE=D0=BA=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormMapWithSetAirplanes.Designer.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.Designer.cs index 33e0540..41244e4 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.Designer.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/FormMapWithSetAirplanes.Designer.cs @@ -70,9 +70,9 @@ this.groupBoxTools.Controls.Add(this.buttonRemoveAirplane); this.groupBoxTools.Controls.Add(this.buttonAddAirplane); this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right; - this.groupBoxTools.Location = new System.Drawing.Point(808, 24); + this.groupBoxTools.Location = new System.Drawing.Point(801, 24); this.groupBoxTools.Name = "groupBoxTools"; - this.groupBoxTools.Size = new System.Drawing.Size(200, 580); + this.groupBoxTools.Size = new System.Drawing.Size(200, 545); this.groupBoxTools.TabIndex = 0; this.groupBoxTools.TabStop = false; this.groupBoxTools.Text = "Инструменты"; @@ -152,7 +152,7 @@ this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonRight.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrRight; this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonRight.Location = new System.Drawing.Point(119, 534); + this.buttonRight.Location = new System.Drawing.Point(121, 509); this.buttonRight.Name = "buttonRight"; this.buttonRight.Size = new System.Drawing.Size(30, 30); this.buttonRight.TabIndex = 8; @@ -164,7 +164,7 @@ this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonLeft.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrLeft; this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonLeft.Location = new System.Drawing.Point(47, 534); + this.buttonLeft.Location = new System.Drawing.Point(49, 509); this.buttonLeft.Name = "buttonLeft"; this.buttonLeft.Size = new System.Drawing.Size(30, 30); this.buttonLeft.TabIndex = 7; @@ -176,7 +176,7 @@ this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDown.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrDown; this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonDown.Location = new System.Drawing.Point(83, 534); + this.buttonDown.Location = new System.Drawing.Point(85, 509); this.buttonDown.Name = "buttonDown"; this.buttonDown.Size = new System.Drawing.Size(30, 30); this.buttonDown.TabIndex = 6; @@ -188,7 +188,7 @@ this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonUp.BackgroundImage = global::AirplaneWithRadar.Properties.Resources.arrUp; this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonUp.Location = new System.Drawing.Point(83, 498); + this.buttonUp.Location = new System.Drawing.Point(85, 473); this.buttonUp.Name = "buttonUp"; this.buttonUp.Size = new System.Drawing.Size(30, 30); this.buttonUp.TabIndex = 5; @@ -240,7 +240,7 @@ this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox.Location = new System.Drawing.Point(0, 24); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(808, 580); + this.pictureBox.Size = new System.Drawing.Size(801, 545); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // @@ -250,7 +250,7 @@ this.файлToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(1008, 24); + this.menuStrip.Size = new System.Drawing.Size(1001, 24); this.menuStrip.TabIndex = 2; this.menuStrip.Text = "menuStrip1"; // @@ -266,14 +266,14 @@ // SaveToolStripMenuItem // this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; - this.SaveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.SaveToolStripMenuItem.Size = new System.Drawing.Size(141, 22); this.SaveToolStripMenuItem.Text = "Сохранение"; this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click); // // LoadToolStripMenuItem // this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; - this.LoadToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.LoadToolStripMenuItem.Size = new System.Drawing.Size(141, 22); this.LoadToolStripMenuItem.Text = "Загрузка"; this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click); // @@ -289,7 +289,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1008, 604); + this.ClientSize = new System.Drawing.Size(1001, 569); this.Controls.Add(this.pictureBox); this.Controls.Add(this.groupBoxTools); this.Controls.Add(this.menuStrip); -- 2.25.1 From fc62891cfc5e6ac5b4144ab820ec6504c92d5846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Sat, 19 Nov 2022 16:15:51 +0400 Subject: [PATCH 3/4] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=207=20=D1=82=D1=80=D0=B5=D0=B1=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs b/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs index caf8518..3e212a8 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/MapsCollection.cs @@ -113,7 +113,7 @@ namespace AirplaneWithRadar { if (!File.Exists(filename)) { - throw new Exception("Файл не найден"); + throw new FileNotFoundException("Файл не найден"); } using (StreamReader fs = new(filename)) { -- 2.25.1 From d5e461cf6b57ef0aceffd21307db3a82804b1fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Wed, 23 Nov 2022 20:59:09 +0400 Subject: [PATCH 4/4] fix --- AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs b/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs index f946680..d1c304b 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/SetAirplanesGeneric.cs @@ -46,7 +46,7 @@ /// Добавляемый самолет /// Позиция /// - public int Insert(T warplane, int position) + public int Insert(T airplane, int position) { if (Count == _maxCount) throw new StorageOverflowException(_maxCount); @@ -54,7 +54,7 @@ { return -1; } - _places.Insert(position, warplane); + _places.Insert(position, airplane); return position; } /// -- 2.25.1