PIbd-23 Firsov Kirill LabWork 06 #26
@ -97,7 +97,7 @@ namespace ProjectTractor.DrawningObjects
|
||||
|
||||
public void ChangeAdditionalColor(Color color)
|
||||
{
|
||||
((EntityBulldoser)EntityTractor).AdditionalColor = color;
|
||||
((EntityBulldoser)EntityTractor).setAdditionalColor(color);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ namespace ProjectTractor.DrawningObjects {
|
||||
{
|
||||
return;
|
||||
}
|
||||
EntityTractor.BodyColor = color;
|
||||
EntityTractor.setBodyColor(color);
|
||||
}
|
||||
|
||||
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||
|
@ -14,7 +14,7 @@ namespace ProjectTractor.Entities
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия обвеса
|
||||
/// </summary>
|
||||
@ -41,6 +41,11 @@ namespace ProjectTractor.Entities
|
||||
WheelsOrnament = wheelsOrnament;
|
||||
Blade = blade;
|
||||
}
|
||||
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace ProjectTractor.Entities
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
@ -39,5 +39,10 @@ namespace ProjectTractor.Entities
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
public void setBodyColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectTractor.Entities;
|
||||
|
||||
namespace ProjectTractor.DrawningObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Расширение для класса EntityTractor
|
||||
/// </summary>
|
||||
public static class ExtentionDrawningTractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Создание объекта из строки
|
||||
/// </summary>
|
||||
/// <param name="info">Строка с данными для создания объекта</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawningTractor? CreateDrawningTractor(this string info, char
|
||||
separatorForObject, int width, int height)
|
||||
{
|
||||
string[] strs = info.Split(separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
{
|
||||
return new DrawningTractor(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||
}
|
||||
if (strs.Length == 6)
|
||||
{
|
||||
return new DrawningBulldoser(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]),
|
||||
Color.FromName(strs[2]),
|
||||
Color.FromName(strs[3]),
|
||||
Convert.ToBoolean(strs[4]),
|
||||
Convert.ToBoolean(strs[5]), width, height);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение данных для сохранения в файл
|
||||
/// </summary>
|
||||
/// <param name="drawingTractor">Сохраняемый объект</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawningTractor drawningTractor,
|
||||
char separatorForObject)
|
||||
{
|
||||
var tractor = drawningTractor.EntityTractor;
|
||||
if (tractor == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var str = $"{tractor.Speed}{separatorForObject}{tractor.Weight}{separatorForObject}{tractor.BodyColor.Name}";
|
||||
if (tractor is not EntityBulldoser bulldoser)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
str = $"{str}{separatorForObject}{bulldoser.AdditionalColor.Name}{separatorForObject}{bulldoser.WheelsOrnament}{separatorForObject}{bulldoser.Blade}";
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
@ -93,6 +93,7 @@ namespace ProjectTractor
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString() ?? string.Empty);
|
||||
listBoxStorages.SelectedItems.Clear();
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
@ -185,6 +186,52 @@ namespace ProjectTractor
|
||||
}
|
||||
pictureBoxCollection.Image = obj.ShowTractors();
|
||||
}
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void toolStripMenuItemSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storage.SaveData(saveFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Сохранение прошло успешно",
|
||||
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Загрузка"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void toolStripMenuItemload_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storage.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Загрузка прошла успешно",
|
||||
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
foreach (var collection in _storage.Keys)
|
||||
{
|
||||
listBoxStorages.Items.Add(collection);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось загрузить", "Результат",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
@ -198,9 +245,15 @@ namespace ProjectTractor
|
||||
this.ButtonRemoveTractor = new System.Windows.Forms.Button();
|
||||
this.ButtonAddTractor = new System.Windows.Forms.Button();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
|
||||
this.file = new System.Windows.Forms.MenuStrip();
|
||||
this.toolStripMenuItemSave = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemload = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.groupBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.file.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBoxCollection
|
||||
@ -208,7 +261,7 @@ namespace ProjectTractor
|
||||
this.pictureBoxCollection.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(620, 536);
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(643, 532);
|
||||
this.pictureBoxCollection.TabIndex = 1;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
@ -219,9 +272,10 @@ namespace ProjectTractor
|
||||
this.groupBox.Controls.Add(this.ButtonRemoveTractor);
|
||||
this.groupBox.Controls.Add(this.ButtonAddTractor);
|
||||
this.groupBox.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.groupBox.Location = new System.Drawing.Point(626, 12);
|
||||
this.groupBox.Controls.Add(this.file);
|
||||
this.groupBox.Location = new System.Drawing.Point(649, 12);
|
||||
this.groupBox.Name = "groupBox";
|
||||
this.groupBox.Size = new System.Drawing.Size(255, 522);
|
||||
this.groupBox.Size = new System.Drawing.Size(255, 524);
|
||||
this.groupBox.TabIndex = 2;
|
||||
this.groupBox.TabStop = false;
|
||||
this.groupBox.Text = "Инструменты";
|
||||
@ -232,7 +286,7 @@ namespace ProjectTractor
|
||||
this.groupBox1.Controls.Add(this.listBoxStorages);
|
||||
this.groupBox1.Controls.Add(this.ButtonAddObject);
|
||||
this.groupBox1.Controls.Add(this.textBoxStorageName);
|
||||
this.groupBox1.Location = new System.Drawing.Point(16, 29);
|
||||
this.groupBox1.Location = new System.Drawing.Point(16, 54);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(224, 279);
|
||||
this.groupBox1.TabIndex = 9;
|
||||
@ -278,7 +332,7 @@ namespace ProjectTractor
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(28, 464);
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(28, 463);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(203, 35);
|
||||
this.ButtonRefreshCollection.TabIndex = 8;
|
||||
@ -288,7 +342,7 @@ namespace ProjectTractor
|
||||
//
|
||||
// ButtonRemoveTractor
|
||||
//
|
||||
this.ButtonRemoveTractor.Location = new System.Drawing.Point(28, 390);
|
||||
this.ButtonRemoveTractor.Location = new System.Drawing.Point(28, 410);
|
||||
this.ButtonRemoveTractor.Name = "ButtonRemoveTractor";
|
||||
this.ButtonRemoveTractor.Size = new System.Drawing.Size(203, 33);
|
||||
this.ButtonRemoveTractor.TabIndex = 7;
|
||||
@ -298,7 +352,7 @@ namespace ProjectTractor
|
||||
//
|
||||
// ButtonAddTractor
|
||||
//
|
||||
this.ButtonAddTractor.Location = new System.Drawing.Point(28, 317);
|
||||
this.ButtonAddTractor.Location = new System.Drawing.Point(28, 337);
|
||||
this.ButtonAddTractor.Name = "ButtonAddTractor";
|
||||
this.ButtonAddTractor.Size = new System.Drawing.Size(203, 34);
|
||||
this.ButtonAddTractor.TabIndex = 6;
|
||||
@ -308,14 +362,49 @@ namespace ProjectTractor
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(28, 357);
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(28, 377);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(203, 27);
|
||||
this.maskedTextBoxNumber.TabIndex = 5;
|
||||
//
|
||||
// file
|
||||
//
|
||||
this.file.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.file.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItemSave,
|
||||
this.toolStripMenuItemload});
|
||||
this.file.Location = new System.Drawing.Point(3, 23);
|
||||
this.file.Name = "file";
|
||||
this.file.Size = new System.Drawing.Size(249, 28);
|
||||
this.file.TabIndex = 10;
|
||||
this.file.Text = "файл";
|
||||
//
|
||||
// toolStripMenuItemSave
|
||||
//
|
||||
this.toolStripMenuItemSave.Name = "toolStripMenuItemSave";
|
||||
this.toolStripMenuItemSave.Size = new System.Drawing.Size(97, 24);
|
||||
this.toolStripMenuItemSave.Text = "Сохранить";
|
||||
this.toolStripMenuItemSave.Click += new System.EventHandler(this.toolStripMenuItemSave_Click);
|
||||
//
|
||||
// toolStripMenuItemload
|
||||
//
|
||||
this.toolStripMenuItemload.Name = "toolStripMenuItemload";
|
||||
this.toolStripMenuItemload.Size = new System.Drawing.Size(83, 24);
|
||||
this.toolStripMenuItemload.Text = "Загрузка";
|
||||
this.toolStripMenuItemload.Click += new System.EventHandler(this.toolStripMenuItemload_Click);
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
this.openFileDialog.FileName = "openFileDialog";
|
||||
this.openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
this.saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormTractorCollection
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(893, 536);
|
||||
this.ClientSize = new System.Drawing.Size(916, 532);
|
||||
this.Controls.Add(this.groupBox);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
@ -328,6 +417,8 @@ namespace ProjectTractor
|
||||
this.groupBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.file.ResumeLayout(false);
|
||||
this.file.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -342,6 +433,11 @@ namespace ProjectTractor
|
||||
private ListBox listBoxStorages;
|
||||
private Button ButtonAddObject;
|
||||
private MaskedTextBox textBoxStorageName;
|
||||
private MenuStrip file;
|
||||
private ToolStripMenuItem toolStripMenuItemSave;
|
||||
private ToolStripMenuItem toolStripMenuItemload;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
private PictureBox pictureBoxCollection;
|
||||
}
|
||||
}
|
||||
|
@ -57,4 +57,16 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="file.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>94, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>261, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
</root>
|
@ -166,7 +166,7 @@
|
||||
// panelBlue
|
||||
//
|
||||
this.panelBlue.AllowDrop = true;
|
||||
this.panelBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
|
||||
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||
this.panelBlue.Location = new System.Drawing.Point(98, 23);
|
||||
this.panelBlue.Name = "panelBlue";
|
||||
this.panelBlue.Size = new System.Drawing.Size(40, 40);
|
||||
@ -188,7 +188,7 @@
|
||||
// panelGreen
|
||||
//
|
||||
this.panelGreen.AllowDrop = true;
|
||||
this.panelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
|
||||
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||
this.panelGreen.Location = new System.Drawing.Point(52, 23);
|
||||
this.panelGreen.Name = "panelGreen";
|
||||
this.panelGreen.Size = new System.Drawing.Size(40, 40);
|
||||
|
@ -17,6 +17,10 @@ namespace ProjectTractor.Generics
|
||||
where T : DrawningTractor
|
||||
where U : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T?> GetTractors => _collection.GetTractors();
|
||||
/// <summary>
|
||||
/// Ширина окна прорисовки
|
||||
/// </summary>
|
||||
@ -82,6 +86,10 @@ namespace ProjectTractor.Generics
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T?> GetCars => _collection.GetTractors();
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
@ -134,12 +142,13 @@ namespace ProjectTractor.Generics
|
||||
if (tractor != null)
|
||||
{
|
||||
int countRows = _pictureWidth / _placeSizeWidth;
|
||||
tractor.SetPosition(_pictureWidth - _placeSizeWidth * 2 - (i % countRows * _placeSizeWidth) + 20, _pictureHeight - i / countRows * _placeSizeHeight - 160);
|
||||
tractor.SetPosition(_pictureWidth - _placeSizeWidth * 2 - (i % countRows * _placeSizeWidth) + 210, _pictureHeight - i / countRows * _placeSizeHeight - 160);
|
||||
tractor.DrawTransport(g);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,18 @@ namespace ProjectTractor
|
||||
/// </summary>
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private static readonly char _separatorForKeyValue = '|';
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly char _separatorRecords = ';';
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly char _separatorForObject = ':';
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="pictureWidth"></param>
|
||||
@ -77,5 +89,90 @@ namespace ProjectTractor
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение информации по автомобилям в хранилище в файл
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
public bool SaveData(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
StringBuilder data = new();
|
||||
foreach (KeyValuePair<string,
|
||||
TractorsGenericCollection<DrawningTractor, DrawningObjectTractor>> record in _tractorStorages)
|
||||
{
|
||||
StringBuilder records = new();
|
||||
foreach (DrawningTractor? elem in record.Value.GetTractors)
|
||||
{
|
||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||
}
|
||||
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
||||
}
|
||||
if (data.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (StreamWriter streamWriter = new(filename))
|
||||
{
|
||||
streamWriter.WriteLine($"TractorStorage{Environment.NewLine}{data}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Загрузка информации по автомобилям в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public bool LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (StreamReader streamReader = new(filename))
|
||||
{
|
||||
string str = streamReader.ReadLine();
|
||||
string[] strings = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strings == null || strings.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!strings[0].StartsWith("TractorStorage"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_tractorStorages.Clear();
|
||||
do
|
||||
{
|
||||
string[] record = str.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 2)
|
||||
{
|
||||
str = streamReader.ReadLine();
|
||||
continue;
|
||||
}
|
||||
TractorsGenericCollection<DrawningTractor, DrawningObjectTractor> collection = new(_pictureWidth, _pictureHeight);
|
||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
DrawningTractor? tractor = elem?.CreateDrawningTractor(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||
if (tractor != null)
|
||||
{
|
||||
if (!(collection + tractor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
_tractorStorages.Add(record[0], collection);
|
||||
str = streamReader.ReadLine();
|
||||
} while (str != null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
4
RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt
Normal file
4
RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/набор №1.txt
Normal file
@ -0,0 +1,4 @@
|
||||
TractorStorage
|
||||
gg|100:100:Yellow;100:100:Blue:Green:True:True;
|
||||
ii|100:100:Purple:Green:True:True;100:100:Red:Yellow:True:True;
|
||||
|
Loading…
Reference in New Issue
Block a user