From d13c774f5a3b4395774158e76ff6545abf411f46 Mon Sep 17 00:00:00 2001 From: pnevmoslon1 Date: Tue, 7 May 2024 00:47:57 +0400 Subject: [PATCH 1/3] lab6 --- .../AbstractCompany.cs | 2 +- .../ICollectionGenericObjects.cs | 7 +- .../ListGenericObjects.cs | 14 +- .../MassiveGenericObjects.cs | 17 +- .../CollectionGenericObjects/PortForShips.cs | 2 +- .../StorageCollection.cs | 146 +++++++++++++++++- .../WarmlyShip/Drawnings/DrawningShip.cs | 6 + .../Drawnings/DrawningWarmlyShip.cs | 5 + .../Drawnings/ExtensionDrawningShip.cs | 41 +++++ WarmlyShip/WarmlyShip/Entities/EntityShip.cs | 15 ++ .../WarmlyShip/Entities/EntityWarmlyShip.cs | 16 ++ .../WarmlyShip/FormShipCollection.Designer.cs | 67 +++++++- WarmlyShip/WarmlyShip/FormShipCollection.cs | 40 ++++- WarmlyShip/WarmlyShip/FormShipCollection.resx | 9 ++ 14 files changed, 369 insertions(+), 18 deletions(-) create mode 100644 WarmlyShip/WarmlyShip/Drawnings/ExtensionDrawningShip.cs diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/AbstractCompany.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/AbstractCompany.cs index fc79304..7030b16 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/AbstractCompany.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/AbstractCompany.cs @@ -29,7 +29,7 @@ public abstract class AbstractCompany _pictureWidth = picWidth; _pictureHeight = picHeight; _collection = collection; - _collection.SetMaxCount = GetMaxCount; + _collection.MaxCount = GetMaxCount; } diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/ICollectionGenericObjects.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/ICollectionGenericObjects.cs index 85b342a..5cf5db0 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -8,7 +8,7 @@ public interface ICollectionGenericObjects int Count { get; } - int SetMaxCount { set; } + int MaxCount { set; get; } int Insert(T obj); @@ -21,4 +21,9 @@ public interface ICollectionGenericObjects T? Get(int position); + + CollectionType GetCollectionType { get; } + + + IEnumerable GetItems(); } diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/ListGenericObjects.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/ListGenericObjects.cs index 3de363c..d9a63a5 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/ListGenericObjects.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/ListGenericObjects.cs @@ -3,15 +3,17 @@ public class ListGenericObjects : ICollectionGenericObjects where T : class { - + public CollectionType GetCollectionType => CollectionType.List; + private readonly List _collection; private int _maxCount; public int Count => _collection.Count; - public int SetMaxCount + public int MaxCount { + get => _maxCount; set { if (value > 0) @@ -70,4 +72,12 @@ public class ListGenericObjects : ICollectionGenericObjects where T : clas _collection.RemoveAt(position); return obj; } + + public IEnumerable GetItems() + { + for (int i = 0; i < Count; i++) + { + yield return _collection[i]; + } + } } diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs index 4eec586..094b059 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs @@ -1,6 +1,6 @@ namespace WarmlyShip.CollectionGenericObjects; -public class MassiveGenericObjects : ICollectionGenericObjects +public class MassiveGenericObjects : ICollectionGenericObjects where T : class { @@ -8,8 +8,12 @@ public class MassiveGenericObjects : ICollectionGenericObjects public int Count => _collection.Length; - public int SetMaxCount + public int MaxCount { + get + { + return _collection.Length; + } set { if (value > 0) @@ -32,6 +36,8 @@ public class MassiveGenericObjects : ICollectionGenericObjects _collection = Array.Empty(); } + public CollectionType GetCollectionType => CollectionType.Massive; + public T? Get(int position) { // TODO проверка позиции @@ -114,4 +120,11 @@ public class MassiveGenericObjects : ICollectionGenericObjects _collection[position] = null; return obj; } + public IEnumerable GetItems() + { + for (int i = 0; i < _collection.Length; i++) + { + yield return _collection[i]; + } + } } diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/PortForShips.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/PortForShips.cs index 8b87612..875bb91 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/PortForShips.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/PortForShips.cs @@ -42,7 +42,7 @@ namespace WarmlyShip.CollectionGenericObjects int countW = 0; int countH = 0; - for (int i = 1; i < _collection.Count; i++) + for (int i = 0; i < _collection.Count; i++) { if (countW == 4) diff --git a/WarmlyShip/WarmlyShip/CollectionGenericObjects/StorageCollection.cs b/WarmlyShip/WarmlyShip/CollectionGenericObjects/StorageCollection.cs index a8000c6..9d92867 100644 --- a/WarmlyShip/WarmlyShip/CollectionGenericObjects/StorageCollection.cs +++ b/WarmlyShip/WarmlyShip/CollectionGenericObjects/StorageCollection.cs @@ -1,18 +1,31 @@ -namespace WarmlyShip.CollectionGenericObjects; +using System.Text; +using WarmlyShip.Drawnings; + +namespace WarmlyShip.CollectionGenericObjects; -public class StorageCollection where T : class +public class StorageCollection where T : DrawningShip { readonly Dictionary> _storages; public List Keys => _storages.Keys.ToList(); + private readonly string _collectionKey = "CollectionStorage"; + + + private readonly string _separatorForKeyValue = "|"; + + + private readonly string _separatorItems = ";"; + + public StorageCollection() { _storages = new Dictionary>(); } + public void AddCollection(string name, CollectionType collectionType) { if (_storages.ContainsKey(name) || collectionType == CollectionType.None) @@ -50,4 +63,133 @@ public class StorageCollection where T : class return null; } } + public bool SaveData(string filename) + { + if (_storages.Count == 0) + { + return false; + } + + if (File.Exists(filename)) + { + File.Delete(filename); + } + + using (StreamWriter writer = new StreamWriter(filename)) + { + writer.Write(_collectionKey); + foreach (KeyValuePair> value in _storages) + { + StringBuilder sb = new(); + + sb.Append(Environment.NewLine); + // не сохраняем пустые коллекции + if (value.Value.Count == 0) + { + continue; + } + + sb.Append(value.Key); + sb.Append(_separatorForKeyValue); + sb.Append(value.Value.GetCollectionType); + sb.Append(_separatorForKeyValue); + sb.Append(value.Value.MaxCount); + sb.Append(_separatorForKeyValue); + + foreach (T? item in value.Value.GetItems()) + { + string data = item?.GetDataForSave() ?? string.Empty; + if (string.IsNullOrEmpty(data)) + { + continue; + } + + sb.Append(data); + sb.Append(_separatorItems); + } + + writer.Write(sb); + } + + } + + return true; + } + + /// + /// Загрузка информации по автомобилям в хранилище из файла + /// + /// Путь и имя файла + /// true - загрузка прошла успешно, false - ошибка при загрузке данных + public bool LoadData(string filename) + { + if (!File.Exists(filename)) + { + return false; + } + + using (StreamReader fs = File.OpenText(filename)) + { + string str = fs.ReadLine(); + + if (str == null || str.Length == 0) + { + return false; + } + + if (!str.StartsWith(_collectionKey)) + { + return false; + } + + _storages.Clear(); + string strs = ""; + while ((strs = fs.ReadLine()) != null) + { + string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries); + if (record.Length != 4) + { + continue; + } + + CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]); + ICollectionGenericObjects? collection = StorageCollection.CreateCollection(collectionType); + if (collection == null) + { + return false; + } + + collection.MaxCount = Convert.ToInt32(record[2]); + + string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); + foreach (string elem in set) + { + if (elem?.CreateDrawningShip() is T ship) + { + if (collection.Insert(ship) == -1) + { + return false; + } + } + } + _storages.Add(record[0], collection); + } + return true; + } + } + + /// + /// Создание коллекции по типа + /// + /// + /// + private static ICollectionGenericObjects? CreateCollection(CollectionType collectionType) + { + return collectionType switch + { + CollectionType.Massive => new MassiveGenericObjects(), + CollectionType.List => new ListGenericObjects(), + _ => null + }; + } } diff --git a/WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs b/WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs index 9b8c86b..dc9b56c 100644 --- a/WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs +++ b/WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs @@ -49,6 +49,12 @@ public class DrawningShip } + public DrawningShip(EntityShip ship) : this() + { + EntityShip = new EntityShip(ship.Speed, ship.Weight, ship.BodyColor); + + } + protected DrawningShip(int drawningWarmlyShipWidth, int drawningWarmlyShipHeigh) : this() { _drawningWarmlyShipWidth = drawningWarmlyShipWidth; diff --git a/WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs b/WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs index 260c1b7..45e6707 100644 --- a/WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs @@ -14,6 +14,11 @@ namespace WarmlyShip.Drawnings { EntityShip = new EntityWarmlyShip(speed, weight, bodyColor, seckondColor, fuelHole, pipes); + } + public DrawningWarmlyShip(EntityWarmlyShip ship) : base(150, 80) + { + EntityShip = new EntityWarmlyShip(ship.Speed, ship.Weight, ship.BodyColor, ship.SeckondColor, ship.FuelHole, ship.Pipes); + } public override void DrawTransport(Graphics g) diff --git a/WarmlyShip/WarmlyShip/Drawnings/ExtensionDrawningShip.cs b/WarmlyShip/WarmlyShip/Drawnings/ExtensionDrawningShip.cs new file mode 100644 index 0000000..50971ea --- /dev/null +++ b/WarmlyShip/WarmlyShip/Drawnings/ExtensionDrawningShip.cs @@ -0,0 +1,41 @@ +using WarmlyShip.Entities; + +namespace WarmlyShip.Drawnings; + +public static class ExtensionDrawningShip +{ + + private static readonly string _separatorForObject = ":"; + + + public static DrawningShip? CreateDrawningShip(this string info) + { + string[] strs = info.Split(_separatorForObject); + + EntityShip? ship = EntityWarmlyShip.CreateEntityWarmlyShip(strs); + if (ship != null) + { + return new DrawningWarmlyShip((EntityWarmlyShip)ship); + } + + ship = EntityShip.CreateEntityShip(strs); + if (ship != null) + { + return new DrawningShip(ship); + } + + return null; + } + + public static string GetDataForSave(this DrawningShip drawningShip) + { + string[]? array = drawningShip?.EntityShip?.GetStringRepresentation(); + + if (array == null) + { + return string.Empty; + } + + return string.Join(_separatorForObject, array); + } +} diff --git a/WarmlyShip/WarmlyShip/Entities/EntityShip.cs b/WarmlyShip/WarmlyShip/Entities/EntityShip.cs index 1d49f82..d35a638 100644 --- a/WarmlyShip/WarmlyShip/Entities/EntityShip.cs +++ b/WarmlyShip/WarmlyShip/Entities/EntityShip.cs @@ -38,5 +38,20 @@ public class EntityShip BodyColor = bodyColor; } + public virtual string[] GetStringRepresentation() + { + return new[] { nameof(EntityShip), Speed.ToString(), Weight.ToString(), BodyColor.Name }; + } + + + public static EntityShip? CreateEntityShip(string[] strs) + { + if (strs.Length != 4 || strs[0] != nameof(EntityShip)) + { + return null; + } + + return new EntityShip(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3])); + } } diff --git a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs index 6fa13b1..546a2cd 100644 --- a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs @@ -48,5 +48,21 @@ public class EntityWarmlyShip : EntityShip Pipes = pipes; } + public virtual string[] GetStringRepresentation() + { + return new[] { nameof(EntityShip), Speed.ToString(), Weight.ToString(), BodyColor.Name, + SeckondColor.Name, FuelHole.ToString(), Pipes.ToString() }; + } + + public static EntityShip? CreateEntityWarmlyShip(string[] strs) + { + if (strs.Length != 7 || strs[0] != nameof(EntityShip)) + { + return null; + } + + return new EntityWarmlyShip(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), + Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6])); + } } diff --git a/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs b/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs index 0263a39..cbb9dfc 100644 --- a/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs +++ b/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs @@ -46,10 +46,17 @@ labelCollectionName = new Label(); comboBoxSelectorCompany = new ComboBox(); pictureBox = new PictureBox(); + menuStrip = new MenuStrip(); + файлToolStripMenuItem = new ToolStripMenuItem(); + saveToolStripMenuItem = new ToolStripMenuItem(); + loadToolStripMenuItem = new ToolStripMenuItem(); + saveFileDialog = new SaveFileDialog(); + openFileDialog = new OpenFileDialog(); groupBoxTools.SuspendLayout(); panelCompanyTools.SuspendLayout(); panelStoreage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + menuStrip.SuspendLayout(); SuspendLayout(); // // groupBoxTools @@ -59,9 +66,9 @@ groupBoxTools.Controls.Add(panelStoreage); groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Dock = DockStyle.Right; - groupBoxTools.Location = new Point(961, 0); + groupBoxTools.Location = new Point(961, 24); groupBoxTools.Name = "groupBoxTools"; - groupBoxTools.Size = new Size(187, 521); + groupBoxTools.Size = new Size(187, 497); groupBoxTools.TabIndex = 0; groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; @@ -236,12 +243,53 @@ // pictureBox // pictureBox.Dock = DockStyle.Fill; - pictureBox.Location = new Point(0, 0); + pictureBox.Location = new Point(0, 24); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(961, 521); + pictureBox.Size = new Size(961, 497); pictureBox.TabIndex = 3; pictureBox.TabStop = false; // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(1148, 24); + menuStrip.TabIndex = 4; + menuStrip.Text = "Файл"; + // + // файлToolStripMenuItem + // + файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem }); + файлToolStripMenuItem.Name = "файлToolStripMenuItem"; + файлToolStripMenuItem.Size = new Size(48, 20); + файлToolStripMenuItem.Text = "Файл"; + // + // saveToolStripMenuItem + // + saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; + saveToolStripMenuItem.Size = new Size(181, 22); + saveToolStripMenuItem.Text = "Сохранение"; + saveToolStripMenuItem.Click += saveToolStripMenuItem_Click; + // + // loadToolStripMenuItem + // + loadToolStripMenuItem.Name = "loadToolStripMenuItem"; + loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L; + loadToolStripMenuItem.Size = new Size(181, 22); + loadToolStripMenuItem.Text = "Загрузка"; + loadToolStripMenuItem.Click += loadToolStripMenuItem_Click; + // + // saveFileDialog + // + saveFileDialog.Filter = "txt file | *.txt"; + // + // openFileDialog + // + openFileDialog.FileName = "openFileDialog1"; + openFileDialog.Filter = "txt file | *.txt"; + // // FormShipCollection // AutoScaleDimensions = new SizeF(7F, 15F); @@ -249,6 +297,8 @@ ClientSize = new Size(1148, 521); Controls.Add(pictureBox); Controls.Add(groupBoxTools); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; Name = "FormShipCollection"; Text = "Коллекция кораблей"; groupBoxTools.ResumeLayout(false); @@ -257,7 +307,10 @@ panelStoreage.ResumeLayout(false); panelStoreage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -280,5 +333,11 @@ private Button buttonCollectionDel; private ListBox listBoxCollection; private Panel panelCompanyTools; + private MenuStrip menuStrip; + private ToolStripMenuItem файлToolStripMenuItem; + private ToolStripMenuItem saveToolStripMenuItem; + private ToolStripMenuItem loadToolStripMenuItem; + private SaveFileDialog saveFileDialog; + private OpenFileDialog openFileDialog; } } \ No newline at end of file diff --git a/WarmlyShip/WarmlyShip/FormShipCollection.cs b/WarmlyShip/WarmlyShip/FormShipCollection.cs index 8359d3f..2e12e78 100644 --- a/WarmlyShip/WarmlyShip/FormShipCollection.cs +++ b/WarmlyShip/WarmlyShip/FormShipCollection.cs @@ -22,7 +22,7 @@ namespace WarmlyShip private AbstractCompany? _company = null; private readonly StorageCollection _storageCollection; - + private void ComboBoxSelectorCompany_SelectedIndexChanged(Object sender, EventArgs e) @@ -30,13 +30,13 @@ namespace WarmlyShip panelCompanyTools.Enabled = false; } - + private void ButtonAddShip_Click(object sender, EventArgs e) { FormShipConfig form = new(); - + form.Show(); form.AddEvent(SetShip); } @@ -125,7 +125,7 @@ namespace WarmlyShip pictureBox.Image = _company.Show(); } - + private void ButtonCollectionAdd_Click(object sender, EventArgs e) { @@ -205,6 +205,36 @@ namespace WarmlyShip } } - + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.SaveData(saveFileDialog.FileName)) + { + MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void loadToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.LoadData(openFileDialog.FileName)) + { + MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + RefreshListBoxItems(); + } } + } diff --git a/WarmlyShip/WarmlyShip/FormShipCollection.resx b/WarmlyShip/WarmlyShip/FormShipCollection.resx index af32865..8b1dfa1 100644 --- a/WarmlyShip/WarmlyShip/FormShipCollection.resx +++ b/WarmlyShip/WarmlyShip/FormShipCollection.resx @@ -117,4 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 126, 17 + + + 261, 17 + \ No newline at end of file -- 2.25.1 From b645f87527665c86d887868e82d79004c18997ef Mon Sep 17 00:00:00 2001 From: Kudyaeva Date: Tue, 7 May 2024 10:40:28 +0400 Subject: [PATCH 2/3] lab6 --- WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs | 6 +++--- WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs index 546a2cd..96fc542 100644 --- a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs @@ -48,16 +48,16 @@ public class EntityWarmlyShip : EntityShip Pipes = pipes; } - public virtual string[] GetStringRepresentation() + public override string[] GetStringRepresentation() { - return new[] { nameof(EntityShip), Speed.ToString(), Weight.ToString(), BodyColor.Name, + return new[] { nameof(EntityWarmlyShip), Speed.ToString(), Weight.ToString(), BodyColor.Name, SeckondColor.Name, FuelHole.ToString(), Pipes.ToString() }; } public static EntityShip? CreateEntityWarmlyShip(string[] strs) { - if (strs.Length != 7 || strs[0] != nameof(EntityShip)) + if (strs.Length != 7 || strs[0] != nameof(EntityWarmlyShip)) { return null; } diff --git a/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs b/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs index cbb9dfc..794aec9 100644 --- a/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs +++ b/WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs @@ -68,7 +68,7 @@ groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Location = new Point(961, 24); groupBoxTools.Name = "groupBoxTools"; - groupBoxTools.Size = new Size(187, 497); + groupBoxTools.Size = new Size(187, 554); groupBoxTools.TabIndex = 0; groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; @@ -245,7 +245,7 @@ pictureBox.Dock = DockStyle.Fill; pictureBox.Location = new Point(0, 24); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(961, 497); + pictureBox.Size = new Size(961, 554); pictureBox.TabIndex = 3; pictureBox.TabStop = false; // @@ -294,7 +294,7 @@ // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1148, 521); + ClientSize = new Size(1148, 578); Controls.Add(pictureBox); Controls.Add(groupBoxTools); Controls.Add(menuStrip); -- 2.25.1 From 738f6481fb55f973a3588a7fea5d3896fccc212d Mon Sep 17 00:00:00 2001 From: pnevmoslon1 Date: Tue, 21 May 2024 02:55:09 +0400 Subject: [PATCH 3/3] lab6 --- WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs index 546a2cd..6f49cfc 100644 --- a/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs @@ -48,7 +48,7 @@ public class EntityWarmlyShip : EntityShip Pipes = pipes; } - public virtual string[] GetStringRepresentation() + public override string[] GetStringRepresentation() { return new[] { nameof(EntityShip), Speed.ToString(), Weight.ToString(), BodyColor.Name, SeckondColor.Name, FuelHole.ToString(), Pipes.ToString() }; -- 2.25.1