laba6 Кувшинов Тимур ПИбд-21 Простая #9
@ -17,7 +17,7 @@ namespace Laba1Loco
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawingTrain CreateDrawningtrain(this string info, char separatorForObject, int width, int height)
|
||||
public static DrawingTrain CreateDrawingTrain(this string info, char separatorForObject, int width, int height)
|
||||
{
|
||||
string[] strs = info.Split(separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
@ -43,22 +43,19 @@ namespace Laba1Loco
|
||||
/// <param name="drawningtrain">Сохраняемый объект</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawingTrain drawningTrain,
|
||||
char separatorForObject)
|
||||
public static string GetDataForSave(this DrawingTrain drawningTrain, char separatorForObject)
|
||||
{
|
||||
var train = drawningTrain.EntityTrain;
|
||||
if (train == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var str =
|
||||
$"{train.Speed}{separatorForObject}{train.Weight}{separatorForObject}{train.BodyColor.Name}";
|
||||
var str = $"{train.Speed}{separatorForObject}{train.Weight}{separatorForObject}{train.BodyColor.Name}";
|
||||
if (!(train is EntityLoco))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return
|
||||
$"{str}{separatorForObject}{(train as EntityLoco).AdditionalColor.Name}{separatorForObject}{(train as EntityLoco).Tube}{separatorForObject}{(train as EntityLoco).FuelTank}{separatorForObject}{(train as EntityLoco).LocoLine}";
|
||||
return $"{str}{separatorForObject}{(train as EntityLoco).AdditionalColor.Name}{separatorForObject}{(train as EntityLoco).Tube}{separatorForObject}{(train as EntityLoco).FuelTank}{separatorForObject}{(train as EntityLoco).LocoLine}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
319
Laba1Loco/Laba1Loco/FormTrainCollection.Designer.cs
generated
319
Laba1Loco/Laba1Loco/FormTrainCollection.Designer.cs
generated
@ -28,146 +28,209 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||
this.ButtonAddTrain = new System.Windows.Forms.Button();
|
||||
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||
this.ButtonRemoveTrain = new System.Windows.Forms.Button();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.textBoxSetName = new System.Windows.Forms.TextBox();
|
||||
this.buttonAddSet = new System.Windows.Forms.Button();
|
||||
this.listBoxStorage = new System.Windows.Forms.ListBox();
|
||||
this.buttonRemoveSet = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
panel1 = new System.Windows.Forms.Panel();
|
||||
panel2 = new System.Windows.Forms.Panel();
|
||||
buttonRemoveSet = new System.Windows.Forms.Button();
|
||||
listBoxStorage = new System.Windows.Forms.ListBox();
|
||||
buttonAddSet = new System.Windows.Forms.Button();
|
||||
textBoxSetName = new System.Windows.Forms.TextBox();
|
||||
maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||
ButtonAddTrain = new System.Windows.Forms.Button();
|
||||
ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||
ButtonRemoveTrain = new System.Windows.Forms.Button();
|
||||
menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
filesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
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(633, 473);
|
||||
this.pictureBoxCollection.TabIndex = 0;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
pictureBoxCollection.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
|
||||
pictureBoxCollection.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new System.Drawing.Size(738, 546);
|
||||
pictureBoxCollection.TabIndex = 0;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AccessibleName = "";
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.panel1.Controls.Add(this.ButtonAddTrain);
|
||||
this.panel1.Controls.Add(this.ButtonRefreshCollection);
|
||||
this.panel1.Controls.Add(this.ButtonRemoveTrain);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panel1.Location = new System.Drawing.Point(639, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(166, 473);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(33, 365);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(100, 20);
|
||||
this.maskedTextBoxNumber.TabIndex = 4;
|
||||
//
|
||||
// ButtonAddTrain
|
||||
//
|
||||
this.ButtonAddTrain.Location = new System.Drawing.Point(43, 327);
|
||||
this.ButtonAddTrain.Name = "ButtonAddTrain";
|
||||
this.ButtonAddTrain.Size = new System.Drawing.Size(75, 23);
|
||||
this.ButtonAddTrain.TabIndex = 3;
|
||||
this.ButtonAddTrain.Text = "Add Train";
|
||||
this.ButtonAddTrain.UseVisualStyleBackColor = true;
|
||||
this.ButtonAddTrain.Click += new System.EventHandler(this.ButtonAddTrain_Click);
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(21, 438);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(121, 23);
|
||||
this.ButtonRefreshCollection.TabIndex = 2;
|
||||
this.ButtonRefreshCollection.Text = "Refresh Collection";
|
||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
||||
//
|
||||
// ButtonRemoveTrain
|
||||
//
|
||||
this.ButtonRemoveTrain.Location = new System.Drawing.Point(33, 400);
|
||||
this.ButtonRemoveTrain.Name = "ButtonRemoveTrain";
|
||||
this.ButtonRemoveTrain.Size = new System.Drawing.Size(100, 23);
|
||||
this.ButtonRemoveTrain.TabIndex = 0;
|
||||
this.ButtonRemoveTrain.Text = "Remove Train";
|
||||
this.ButtonRemoveTrain.UseVisualStyleBackColor = true;
|
||||
this.ButtonRemoveTrain.Click += new System.EventHandler(this.ButtonRemoveTrain_Click);
|
||||
panel1.AccessibleName = "";
|
||||
panel1.Controls.Add(panel2);
|
||||
panel1.Controls.Add(maskedTextBoxNumber);
|
||||
panel1.Controls.Add(ButtonAddTrain);
|
||||
panel1.Controls.Add(ButtonRefreshCollection);
|
||||
panel1.Controls.Add(ButtonRemoveTrain);
|
||||
panel1.Controls.Add(menuStrip1);
|
||||
panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
panel1.Location = new System.Drawing.Point(745, 0);
|
||||
panel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new System.Drawing.Size(194, 546);
|
||||
panel1.TabIndex = 1;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.AccessibleName = "";
|
||||
this.panel2.Controls.Add(this.buttonRemoveSet);
|
||||
this.panel2.Controls.Add(this.listBoxStorage);
|
||||
this.panel2.Controls.Add(this.buttonAddSet);
|
||||
this.panel2.Controls.Add(this.textBoxSetName);
|
||||
this.panel2.Location = new System.Drawing.Point(14, 12);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(140, 208);
|
||||
this.panel2.TabIndex = 5;
|
||||
//
|
||||
// textBoxSetName
|
||||
//
|
||||
this.textBoxSetName.Location = new System.Drawing.Point(8, 12);
|
||||
this.textBoxSetName.Name = "textBoxSetName";
|
||||
this.textBoxSetName.Size = new System.Drawing.Size(120, 20);
|
||||
this.textBoxSetName.TabIndex = 0;
|
||||
//
|
||||
// buttonAddSet
|
||||
//
|
||||
this.buttonAddSet.Location = new System.Drawing.Point(8, 38);
|
||||
this.buttonAddSet.Name = "buttonAddSet";
|
||||
this.buttonAddSet.Size = new System.Drawing.Size(120, 23);
|
||||
this.buttonAddSet.TabIndex = 1;
|
||||
this.buttonAddSet.Text = "Add set";
|
||||
this.buttonAddSet.UseVisualStyleBackColor = true;
|
||||
this.buttonAddSet.Click += new System.EventHandler(this.buttonAddSet_Click);
|
||||
//
|
||||
// listBoxStorage
|
||||
//
|
||||
this.listBoxStorage.FormattingEnabled = true;
|
||||
this.listBoxStorage.Location = new System.Drawing.Point(8, 67);
|
||||
this.listBoxStorage.Name = "listBoxStorage";
|
||||
this.listBoxStorage.Size = new System.Drawing.Size(120, 95);
|
||||
this.listBoxStorage.TabIndex = 2;
|
||||
this.listBoxStorage.SelectedIndexChanged += new System.EventHandler(this.listBoxStorage_SelectedIndexChanged);
|
||||
panel2.AccessibleName = "";
|
||||
panel2.Controls.Add(buttonRemoveSet);
|
||||
panel2.Controls.Add(listBoxStorage);
|
||||
panel2.Controls.Add(buttonAddSet);
|
||||
panel2.Controls.Add(textBoxSetName);
|
||||
panel2.Location = new System.Drawing.Point(18, 98);
|
||||
panel2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new System.Drawing.Size(163, 240);
|
||||
panel2.TabIndex = 5;
|
||||
//
|
||||
// buttonRemoveSet
|
||||
//
|
||||
this.buttonRemoveSet.Location = new System.Drawing.Point(8, 168);
|
||||
this.buttonRemoveSet.Name = "buttonRemoveSet";
|
||||
this.buttonRemoveSet.Size = new System.Drawing.Size(120, 23);
|
||||
this.buttonRemoveSet.TabIndex = 3;
|
||||
this.buttonRemoveSet.Text = "Remove set";
|
||||
this.buttonRemoveSet.UseVisualStyleBackColor = true;
|
||||
this.buttonRemoveSet.Click += new System.EventHandler(this.buttonRemoveSet_Click);
|
||||
buttonRemoveSet.Location = new System.Drawing.Point(9, 194);
|
||||
buttonRemoveSet.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
buttonRemoveSet.Name = "buttonRemoveSet";
|
||||
buttonRemoveSet.Size = new System.Drawing.Size(140, 27);
|
||||
buttonRemoveSet.TabIndex = 3;
|
||||
buttonRemoveSet.Text = "Remove set";
|
||||
buttonRemoveSet.UseVisualStyleBackColor = true;
|
||||
buttonRemoveSet.Click += buttonRemoveSet_Click;
|
||||
//
|
||||
// listBoxStorage
|
||||
//
|
||||
listBoxStorage.FormattingEnabled = true;
|
||||
listBoxStorage.ItemHeight = 15;
|
||||
listBoxStorage.Location = new System.Drawing.Point(9, 77);
|
||||
listBoxStorage.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
listBoxStorage.Name = "listBoxStorage";
|
||||
listBoxStorage.Size = new System.Drawing.Size(139, 109);
|
||||
listBoxStorage.TabIndex = 2;
|
||||
listBoxStorage.SelectedIndexChanged += listBoxStorage_SelectedIndexChanged;
|
||||
//
|
||||
// buttonAddSet
|
||||
//
|
||||
buttonAddSet.Location = new System.Drawing.Point(9, 44);
|
||||
buttonAddSet.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
buttonAddSet.Name = "buttonAddSet";
|
||||
buttonAddSet.Size = new System.Drawing.Size(140, 27);
|
||||
buttonAddSet.TabIndex = 1;
|
||||
buttonAddSet.Text = "Add set";
|
||||
buttonAddSet.UseVisualStyleBackColor = true;
|
||||
buttonAddSet.Click += buttonAddSet_Click;
|
||||
//
|
||||
// textBoxSetName
|
||||
//
|
||||
textBoxSetName.Location = new System.Drawing.Point(9, 14);
|
||||
textBoxSetName.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
textBoxSetName.Name = "textBoxSetName";
|
||||
textBoxSetName.Size = new System.Drawing.Size(139, 23);
|
||||
textBoxSetName.TabIndex = 0;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
maskedTextBoxNumber.Location = new System.Drawing.Point(38, 421);
|
||||
maskedTextBoxNumber.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
maskedTextBoxNumber.Size = new System.Drawing.Size(116, 23);
|
||||
maskedTextBoxNumber.TabIndex = 4;
|
||||
//
|
||||
// ButtonAddTrain
|
||||
//
|
||||
ButtonAddTrain.Location = new System.Drawing.Point(50, 377);
|
||||
ButtonAddTrain.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
ButtonAddTrain.Name = "ButtonAddTrain";
|
||||
ButtonAddTrain.Size = new System.Drawing.Size(88, 27);
|
||||
ButtonAddTrain.TabIndex = 3;
|
||||
ButtonAddTrain.Text = "Add Train";
|
||||
ButtonAddTrain.UseVisualStyleBackColor = true;
|
||||
ButtonAddTrain.Click += ButtonAddTrain_Click;
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
ButtonRefreshCollection.Location = new System.Drawing.Point(24, 505);
|
||||
ButtonRefreshCollection.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
ButtonRefreshCollection.Size = new System.Drawing.Size(141, 27);
|
||||
ButtonRefreshCollection.TabIndex = 2;
|
||||
ButtonRefreshCollection.Text = "Refresh Collection";
|
||||
ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
ButtonRefreshCollection.Click += ButtonRefreshCollection_Click;
|
||||
//
|
||||
// ButtonRemoveTrain
|
||||
//
|
||||
ButtonRemoveTrain.Location = new System.Drawing.Point(38, 462);
|
||||
ButtonRemoveTrain.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
ButtonRemoveTrain.Name = "ButtonRemoveTrain";
|
||||
ButtonRemoveTrain.Size = new System.Drawing.Size(117, 27);
|
||||
ButtonRemoveTrain.TabIndex = 0;
|
||||
ButtonRemoveTrain.Text = "Remove Train";
|
||||
ButtonRemoveTrain.UseVisualStyleBackColor = true;
|
||||
ButtonRemoveTrain.Click += ButtonRemoveTrain_Click;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { filesToolStripMenuItem });
|
||||
menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new System.Drawing.Size(194, 24);
|
||||
menuStrip1.TabIndex = 6;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// filesToolStripMenuItem
|
||||
//
|
||||
filesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
||||
filesToolStripMenuItem.Name = "filesToolStripMenuItem";
|
||||
filesToolStripMenuItem.Size = new System.Drawing.Size(42, 20);
|
||||
filesToolStripMenuItem.Text = "Files";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
saveToolStripMenuItem.Text = "Save";
|
||||
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||
//
|
||||
// loadToolStripMenuItem
|
||||
//
|
||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||
loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
loadToolStripMenuItem.Text = "Load";
|
||||
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.FileName = "TrainSave.txt";
|
||||
openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
saveFileDialog.FileName = "TrainSave.txt";
|
||||
saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormTrainCollection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(805, 473);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.Name = "FormTrainCollection";
|
||||
this.Text = "FormTrainCollection";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(939, 546);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(pictureBoxCollection);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
Name = "FormTrainCollection";
|
||||
Text = "FormTrainCollection";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
panel2.ResumeLayout(false);
|
||||
panel2.PerformLayout();
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -183,5 +246,11 @@
|
||||
private System.Windows.Forms.ListBox listBoxStorage;
|
||||
private System.Windows.Forms.Button buttonAddSet;
|
||||
private System.Windows.Forms.TextBox textBoxSetName;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem filesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
||||
}
|
||||
}
|
@ -189,5 +189,50 @@ namespace Laba1Loco
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveToolStripMenuItem_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 LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storage.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Загрузка прошла успешно",
|
||||
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не загрузилось", "Результат",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
ReloadObjects();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
@ -117,4 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.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>132, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>271, 17</value>
|
||||
</metadata>
|
||||
</root>
|
513
Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs
generated
513
Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs
generated
@ -28,339 +28,342 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ParamsGroup = new System.Windows.Forms.GroupBox();
|
||||
this.labelLoco = new System.Windows.Forms.Label();
|
||||
this.labelTrain = new System.Windows.Forms.Label();
|
||||
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||
this.panelPurple = new System.Windows.Forms.Panel();
|
||||
this.panelYellow = new System.Windows.Forms.Panel();
|
||||
this.panelBlue = new System.Windows.Forms.Panel();
|
||||
this.panelRed = new System.Windows.Forms.Panel();
|
||||
this.panelDarkBlue = new System.Windows.Forms.Panel();
|
||||
this.panelOrange = new System.Windows.Forms.Panel();
|
||||
this.panelGreen = new System.Windows.Forms.Panel();
|
||||
this.panelGray = new System.Windows.Forms.Panel();
|
||||
this.checkBoxFuelTank = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxLocoLine = new System.Windows.Forms.CheckBox();
|
||||
this.numericWeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericSpeed = new System.Windows.Forms.NumericUpDown();
|
||||
this.weightLabel = new System.Windows.Forms.Label();
|
||||
this.speedLabel = new System.Windows.Forms.Label();
|
||||
this.panel9 = new System.Windows.Forms.Panel();
|
||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.labelColor = new System.Windows.Forms.Label();
|
||||
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
||||
this.ParamsGroup.SuspendLayout();
|
||||
this.groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericWeight)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).BeginInit();
|
||||
this.panel9.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
ParamsGroup = new System.Windows.Forms.GroupBox();
|
||||
labelLoco = new System.Windows.Forms.Label();
|
||||
labelTrain = new System.Windows.Forms.Label();
|
||||
groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||
panelPurple = new System.Windows.Forms.Panel();
|
||||
panelYellow = new System.Windows.Forms.Panel();
|
||||
panelBlue = new System.Windows.Forms.Panel();
|
||||
panelRed = new System.Windows.Forms.Panel();
|
||||
panelDarkBlue = new System.Windows.Forms.Panel();
|
||||
panelOrange = new System.Windows.Forms.Panel();
|
||||
panelGreen = new System.Windows.Forms.Panel();
|
||||
panelGray = new System.Windows.Forms.Panel();
|
||||
checkBoxFuelTank = new System.Windows.Forms.CheckBox();
|
||||
checkBoxSmokeTube = new System.Windows.Forms.CheckBox();
|
||||
checkBoxLocoLine = new System.Windows.Forms.CheckBox();
|
||||
numericWeight = new System.Windows.Forms.NumericUpDown();
|
||||
numericSpeed = new System.Windows.Forms.NumericUpDown();
|
||||
weightLabel = new System.Windows.Forms.Label();
|
||||
speedLabel = new System.Windows.Forms.Label();
|
||||
panel9 = new System.Windows.Forms.Panel();
|
||||
pictureBox = new System.Windows.Forms.PictureBox();
|
||||
buttonAdd = new System.Windows.Forms.Button();
|
||||
buttonCancel = new System.Windows.Forms.Button();
|
||||
labelColor = new System.Windows.Forms.Label();
|
||||
labelAdditionalColor = new System.Windows.Forms.Label();
|
||||
ParamsGroup.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericSpeed).BeginInit();
|
||||
panel9.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ParamsGroup
|
||||
//
|
||||
this.ParamsGroup.Controls.Add(this.labelLoco);
|
||||
this.ParamsGroup.Controls.Add(this.labelTrain);
|
||||
this.ParamsGroup.Controls.Add(this.groupBoxColors);
|
||||
this.ParamsGroup.Controls.Add(this.checkBoxFuelTank);
|
||||
this.ParamsGroup.Controls.Add(this.checkBoxSmokeTube);
|
||||
this.ParamsGroup.Controls.Add(this.checkBoxLocoLine);
|
||||
this.ParamsGroup.Controls.Add(this.numericWeight);
|
||||
this.ParamsGroup.Controls.Add(this.numericSpeed);
|
||||
this.ParamsGroup.Controls.Add(this.weightLabel);
|
||||
this.ParamsGroup.Controls.Add(this.speedLabel);
|
||||
this.ParamsGroup.Location = new System.Drawing.Point(3, 2);
|
||||
this.ParamsGroup.Name = "ParamsGroup";
|
||||
this.ParamsGroup.Size = new System.Drawing.Size(180, 481);
|
||||
this.ParamsGroup.TabIndex = 0;
|
||||
this.ParamsGroup.TabStop = false;
|
||||
this.ParamsGroup.Text = "Params Group Box";
|
||||
ParamsGroup.Controls.Add(labelLoco);
|
||||
ParamsGroup.Controls.Add(labelTrain);
|
||||
ParamsGroup.Controls.Add(groupBoxColors);
|
||||
ParamsGroup.Controls.Add(checkBoxFuelTank);
|
||||
ParamsGroup.Controls.Add(checkBoxSmokeTube);
|
||||
ParamsGroup.Controls.Add(checkBoxLocoLine);
|
||||
ParamsGroup.Controls.Add(numericWeight);
|
||||
ParamsGroup.Controls.Add(numericSpeed);
|
||||
ParamsGroup.Controls.Add(weightLabel);
|
||||
ParamsGroup.Controls.Add(speedLabel);
|
||||
ParamsGroup.Location = new System.Drawing.Point(4, 2);
|
||||
ParamsGroup.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
ParamsGroup.Name = "ParamsGroup";
|
||||
ParamsGroup.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
ParamsGroup.Size = new System.Drawing.Size(210, 555);
|
||||
ParamsGroup.TabIndex = 0;
|
||||
ParamsGroup.TabStop = false;
|
||||
ParamsGroup.Text = "Params Group Box";
|
||||
//
|
||||
// labelLoco
|
||||
//
|
||||
this.labelLoco.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelLoco.Location = new System.Drawing.Point(90, 419);
|
||||
this.labelLoco.Name = "labelLoco";
|
||||
this.labelLoco.Size = new System.Drawing.Size(65, 37);
|
||||
this.labelLoco.TabIndex = 10;
|
||||
this.labelLoco.Text = "Loco";
|
||||
this.labelLoco.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelLoco.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||
labelLoco.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
labelLoco.Location = new System.Drawing.Point(105, 483);
|
||||
labelLoco.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
labelLoco.Name = "labelLoco";
|
||||
labelLoco.Size = new System.Drawing.Size(76, 42);
|
||||
labelLoco.TabIndex = 10;
|
||||
labelLoco.Text = "Loco";
|
||||
labelLoco.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
labelLoco.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelTrain
|
||||
//
|
||||
this.labelTrain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelTrain.Location = new System.Drawing.Point(14, 419);
|
||||
this.labelTrain.Name = "labelTrain";
|
||||
this.labelTrain.Size = new System.Drawing.Size(65, 37);
|
||||
this.labelTrain.TabIndex = 9;
|
||||
this.labelTrain.Text = "Train";
|
||||
this.labelTrain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelTrain.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||
labelTrain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
labelTrain.Location = new System.Drawing.Point(16, 483);
|
||||
labelTrain.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
labelTrain.Name = "labelTrain";
|
||||
labelTrain.Size = new System.Drawing.Size(76, 42);
|
||||
labelTrain.TabIndex = 9;
|
||||
labelTrain.Text = "Train";
|
||||
labelTrain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
labelTrain.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
this.groupBoxColors.Controls.Add(this.panelPurple);
|
||||
this.groupBoxColors.Controls.Add(this.panelYellow);
|
||||
this.groupBoxColors.Controls.Add(this.panelBlue);
|
||||
this.groupBoxColors.Controls.Add(this.panelRed);
|
||||
this.groupBoxColors.Controls.Add(this.panelDarkBlue);
|
||||
this.groupBoxColors.Controls.Add(this.panelOrange);
|
||||
this.groupBoxColors.Controls.Add(this.panelGreen);
|
||||
this.groupBoxColors.Controls.Add(this.panelGray);
|
||||
this.groupBoxColors.Location = new System.Drawing.Point(12, 174);
|
||||
this.groupBoxColors.Name = "groupBoxColors";
|
||||
this.groupBoxColors.Size = new System.Drawing.Size(158, 226);
|
||||
this.groupBoxColors.TabIndex = 8;
|
||||
this.groupBoxColors.TabStop = false;
|
||||
this.groupBoxColors.Text = "Colors";
|
||||
groupBoxColors.Controls.Add(panelPurple);
|
||||
groupBoxColors.Controls.Add(panelYellow);
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Controls.Add(panelDarkBlue);
|
||||
groupBoxColors.Controls.Add(panelOrange);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelGray);
|
||||
groupBoxColors.Location = new System.Drawing.Point(14, 201);
|
||||
groupBoxColors.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
groupBoxColors.Size = new System.Drawing.Size(184, 261);
|
||||
groupBoxColors.TabIndex = 8;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Colors";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
this.panelPurple.BackColor = System.Drawing.Color.Fuchsia;
|
||||
this.panelPurple.Location = new System.Drawing.Point(81, 179);
|
||||
this.panelPurple.Name = "panelPurple";
|
||||
this.panelPurple.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelPurple.TabIndex = 3;
|
||||
panelPurple.BackColor = System.Drawing.Color.Fuchsia;
|
||||
panelPurple.Location = new System.Drawing.Point(94, 207);
|
||||
panelPurple.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new System.Drawing.Size(49, 46);
|
||||
panelPurple.TabIndex = 3;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||
this.panelYellow.Location = new System.Drawing.Point(81, 70);
|
||||
this.panelYellow.Name = "panelYellow";
|
||||
this.panelYellow.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelYellow.TabIndex = 1;
|
||||
panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||
panelYellow.Location = new System.Drawing.Point(94, 81);
|
||||
panelYellow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new System.Drawing.Size(49, 46);
|
||||
panelYellow.TabIndex = 1;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
this.panelBlue.BackColor = System.Drawing.Color.Cyan;
|
||||
this.panelBlue.Location = new System.Drawing.Point(81, 125);
|
||||
this.panelBlue.Name = "panelBlue";
|
||||
this.panelBlue.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelBlue.TabIndex = 4;
|
||||
panelBlue.BackColor = System.Drawing.Color.Cyan;
|
||||
panelBlue.Location = new System.Drawing.Point(94, 144);
|
||||
panelBlue.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new System.Drawing.Size(49, 46);
|
||||
panelBlue.TabIndex = 4;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||
this.panelRed.Location = new System.Drawing.Point(81, 16);
|
||||
this.panelRed.Name = "panelRed";
|
||||
this.panelRed.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelRed.TabIndex = 1;
|
||||
panelRed.BackColor = System.Drawing.Color.Red;
|
||||
panelRed.Location = new System.Drawing.Point(94, 18);
|
||||
panelRed.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new System.Drawing.Size(49, 46);
|
||||
panelRed.TabIndex = 1;
|
||||
//
|
||||
// panelDarkBlue
|
||||
//
|
||||
this.panelDarkBlue.BackColor = System.Drawing.Color.Blue;
|
||||
this.panelDarkBlue.Location = new System.Drawing.Point(25, 179);
|
||||
this.panelDarkBlue.Name = "panelDarkBlue";
|
||||
this.panelDarkBlue.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelDarkBlue.TabIndex = 5;
|
||||
panelDarkBlue.BackColor = System.Drawing.Color.Blue;
|
||||
panelDarkBlue.Location = new System.Drawing.Point(29, 207);
|
||||
panelDarkBlue.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelDarkBlue.Name = "panelDarkBlue";
|
||||
panelDarkBlue.Size = new System.Drawing.Size(49, 46);
|
||||
panelDarkBlue.TabIndex = 5;
|
||||
//
|
||||
// panelOrange
|
||||
//
|
||||
this.panelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
|
||||
this.panelOrange.Location = new System.Drawing.Point(25, 70);
|
||||
this.panelOrange.Name = "panelOrange";
|
||||
this.panelOrange.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelOrange.TabIndex = 1;
|
||||
panelOrange.BackColor = System.Drawing.Color.LightSalmon;
|
||||
panelOrange.Location = new System.Drawing.Point(29, 81);
|
||||
panelOrange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelOrange.Name = "panelOrange";
|
||||
panelOrange.Size = new System.Drawing.Size(49, 46);
|
||||
panelOrange.TabIndex = 1;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
this.panelGreen.BackColor = System.Drawing.Color.Lime;
|
||||
this.panelGreen.Location = new System.Drawing.Point(25, 125);
|
||||
this.panelGreen.Name = "panelGreen";
|
||||
this.panelGreen.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelGreen.TabIndex = 2;
|
||||
panelGreen.BackColor = System.Drawing.Color.Lime;
|
||||
panelGreen.Location = new System.Drawing.Point(29, 144);
|
||||
panelGreen.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new System.Drawing.Size(49, 46);
|
||||
panelGreen.TabIndex = 2;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
this.panelGray.BackColor = System.Drawing.Color.Silver;
|
||||
this.panelGray.Location = new System.Drawing.Point(25, 16);
|
||||
this.panelGray.Name = "panelGray";
|
||||
this.panelGray.Size = new System.Drawing.Size(42, 40);
|
||||
this.panelGray.TabIndex = 0;
|
||||
panelGray.BackColor = System.Drawing.Color.Silver;
|
||||
panelGray.Location = new System.Drawing.Point(29, 18);
|
||||
panelGray.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new System.Drawing.Size(49, 46);
|
||||
panelGray.TabIndex = 0;
|
||||
//
|
||||
// checkBoxFuelTank
|
||||
//
|
||||
this.checkBoxFuelTank.AutoSize = true;
|
||||
this.checkBoxFuelTank.Location = new System.Drawing.Point(14, 117);
|
||||
this.checkBoxFuelTank.Name = "checkBoxFuelTank";
|
||||
this.checkBoxFuelTank.Size = new System.Drawing.Size(70, 17);
|
||||
this.checkBoxFuelTank.TabIndex = 7;
|
||||
this.checkBoxFuelTank.Text = "Fuel tank";
|
||||
this.checkBoxFuelTank.UseVisualStyleBackColor = true;
|
||||
checkBoxFuelTank.AutoSize = true;
|
||||
checkBoxFuelTank.Location = new System.Drawing.Point(16, 135);
|
||||
checkBoxFuelTank.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
checkBoxFuelTank.Name = "checkBoxFuelTank";
|
||||
checkBoxFuelTank.Size = new System.Drawing.Size(74, 19);
|
||||
checkBoxFuelTank.TabIndex = 7;
|
||||
checkBoxFuelTank.Text = "Fuel tank";
|
||||
checkBoxFuelTank.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxSmokeTube
|
||||
//
|
||||
this.checkBoxSmokeTube.AutoSize = true;
|
||||
this.checkBoxSmokeTube.Location = new System.Drawing.Point(14, 97);
|
||||
this.checkBoxSmokeTube.Name = "checkBoxSmokeTube";
|
||||
this.checkBoxSmokeTube.Size = new System.Drawing.Size(83, 17);
|
||||
this.checkBoxSmokeTube.TabIndex = 6;
|
||||
this.checkBoxSmokeTube.Text = "Smoke tube";
|
||||
this.checkBoxSmokeTube.UseVisualStyleBackColor = true;
|
||||
checkBoxSmokeTube.AutoSize = true;
|
||||
checkBoxSmokeTube.Location = new System.Drawing.Point(16, 112);
|
||||
checkBoxSmokeTube.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
checkBoxSmokeTube.Name = "checkBoxSmokeTube";
|
||||
checkBoxSmokeTube.Size = new System.Drawing.Size(89, 19);
|
||||
checkBoxSmokeTube.TabIndex = 6;
|
||||
checkBoxSmokeTube.Text = "Smoke tube";
|
||||
checkBoxSmokeTube.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxLocoLine
|
||||
//
|
||||
this.checkBoxLocoLine.AutoSize = true;
|
||||
this.checkBoxLocoLine.Location = new System.Drawing.Point(14, 140);
|
||||
this.checkBoxLocoLine.Name = "checkBoxLocoLine";
|
||||
this.checkBoxLocoLine.Size = new System.Drawing.Size(69, 17);
|
||||
this.checkBoxLocoLine.TabIndex = 5;
|
||||
this.checkBoxLocoLine.Text = "Loco line";
|
||||
this.checkBoxLocoLine.UseVisualStyleBackColor = true;
|
||||
checkBoxLocoLine.AutoSize = true;
|
||||
checkBoxLocoLine.Location = new System.Drawing.Point(16, 162);
|
||||
checkBoxLocoLine.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
checkBoxLocoLine.Name = "checkBoxLocoLine";
|
||||
checkBoxLocoLine.Size = new System.Drawing.Size(74, 19);
|
||||
checkBoxLocoLine.TabIndex = 5;
|
||||
checkBoxLocoLine.Text = "Loco line";
|
||||
checkBoxLocoLine.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericWeight
|
||||
//
|
||||
this.numericWeight.Location = new System.Drawing.Point(50, 51);
|
||||
this.numericWeight.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericWeight.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericWeight.Name = "numericWeight";
|
||||
this.numericWeight.Size = new System.Drawing.Size(120, 20);
|
||||
this.numericWeight.TabIndex = 4;
|
||||
this.numericWeight.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
numericWeight.Location = new System.Drawing.Point(58, 59);
|
||||
numericWeight.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
numericWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericWeight.Name = "numericWeight";
|
||||
numericWeight.Size = new System.Drawing.Size(140, 23);
|
||||
numericWeight.TabIndex = 4;
|
||||
numericWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericSpeed
|
||||
//
|
||||
this.numericSpeed.Location = new System.Drawing.Point(50, 23);
|
||||
this.numericSpeed.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericSpeed.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericSpeed.Name = "numericSpeed";
|
||||
this.numericSpeed.Size = new System.Drawing.Size(120, 20);
|
||||
this.numericSpeed.TabIndex = 3;
|
||||
this.numericSpeed.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
numericSpeed.Location = new System.Drawing.Point(58, 27);
|
||||
numericSpeed.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
numericSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericSpeed.Name = "numericSpeed";
|
||||
numericSpeed.Size = new System.Drawing.Size(140, 23);
|
||||
numericSpeed.TabIndex = 3;
|
||||
numericSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// weightLabel
|
||||
//
|
||||
this.weightLabel.AutoSize = true;
|
||||
this.weightLabel.Location = new System.Drawing.Point(9, 51);
|
||||
this.weightLabel.Name = "weightLabel";
|
||||
this.weightLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.weightLabel.TabIndex = 2;
|
||||
this.weightLabel.Text = "weigh";
|
||||
weightLabel.AutoSize = true;
|
||||
weightLabel.Location = new System.Drawing.Point(10, 59);
|
||||
weightLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
weightLabel.Name = "weightLabel";
|
||||
weightLabel.Size = new System.Drawing.Size(39, 15);
|
||||
weightLabel.TabIndex = 2;
|
||||
weightLabel.Text = "weigh";
|
||||
//
|
||||
// speedLabel
|
||||
//
|
||||
this.speedLabel.AutoSize = true;
|
||||
this.speedLabel.Location = new System.Drawing.Point(9, 25);
|
||||
this.speedLabel.Name = "speedLabel";
|
||||
this.speedLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.speedLabel.TabIndex = 1;
|
||||
this.speedLabel.Text = "speed";
|
||||
speedLabel.AutoSize = true;
|
||||
speedLabel.Location = new System.Drawing.Point(10, 29);
|
||||
speedLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
speedLabel.Name = "speedLabel";
|
||||
speedLabel.Size = new System.Drawing.Size(38, 15);
|
||||
speedLabel.TabIndex = 1;
|
||||
speedLabel.Text = "speed";
|
||||
//
|
||||
// panel9
|
||||
//
|
||||
this.panel9.AllowDrop = true;
|
||||
this.panel9.Controls.Add(this.pictureBox);
|
||||
this.panel9.Location = new System.Drawing.Point(200, 75);
|
||||
this.panel9.Name = "panel9";
|
||||
this.panel9.Size = new System.Drawing.Size(588, 338);
|
||||
this.panel9.TabIndex = 11;
|
||||
this.panel9.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||
this.panel9.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||
panel9.AllowDrop = true;
|
||||
panel9.Controls.Add(pictureBox);
|
||||
panel9.Location = new System.Drawing.Point(233, 87);
|
||||
panel9.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panel9.Name = "panel9";
|
||||
panel9.Size = new System.Drawing.Size(686, 390);
|
||||
panel9.TabIndex = 11;
|
||||
panel9.DragDrop += PanelObject_DragDrop;
|
||||
panel9.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
this.pictureBox.Location = new System.Drawing.Point(14, 5);
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.Size = new System.Drawing.Size(555, 330);
|
||||
this.pictureBox.TabIndex = 0;
|
||||
this.pictureBox.TabStop = false;
|
||||
pictureBox.Location = new System.Drawing.Point(16, 6);
|
||||
pictureBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new System.Drawing.Size(648, 381);
|
||||
pictureBox.TabIndex = 0;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(200, 421);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAdd.TabIndex = 12;
|
||||
this.buttonAdd.Text = "Add";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||
buttonAdd.Location = new System.Drawing.Point(233, 486);
|
||||
buttonAdd.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new System.Drawing.Size(88, 27);
|
||||
buttonAdd.TabIndex = 12;
|
||||
buttonAdd.Text = "Add";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonOk_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(515, 421);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 13;
|
||||
this.buttonCancel.Text = "Cancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Location = new System.Drawing.Point(601, 486);
|
||||
buttonCancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new System.Drawing.Size(88, 27);
|
||||
buttonCancel.TabIndex = 13;
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
this.labelColor.AllowDrop = true;
|
||||
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelColor.Location = new System.Drawing.Point(200, 25);
|
||||
this.labelColor.Name = "labelColor";
|
||||
this.labelColor.Size = new System.Drawing.Size(100, 23);
|
||||
this.labelColor.TabIndex = 14;
|
||||
this.labelColor.Text = "Color";
|
||||
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop);
|
||||
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||
labelColor.AllowDrop = true;
|
||||
labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
labelColor.Location = new System.Drawing.Point(233, 29);
|
||||
labelColor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
labelColor.Name = "labelColor";
|
||||
labelColor.Size = new System.Drawing.Size(116, 26);
|
||||
labelColor.TabIndex = 14;
|
||||
labelColor.Text = "Color";
|
||||
labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
labelColor.DragDrop += labelColor_DragDrop;
|
||||
labelColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
this.labelAdditionalColor.AllowDrop = true;
|
||||
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelAdditionalColor.Location = new System.Drawing.Point(515, 24);
|
||||
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
this.labelAdditionalColor.Size = new System.Drawing.Size(100, 23);
|
||||
this.labelAdditionalColor.TabIndex = 15;
|
||||
this.labelAdditionalColor.Text = "Additional color";
|
||||
this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop);
|
||||
this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new System.Drawing.Point(601, 28);
|
||||
labelAdditionalColor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new System.Drawing.Size(116, 26);
|
||||
labelAdditionalColor.TabIndex = 15;
|
||||
labelAdditionalColor.Text = "Additional color";
|
||||
labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// FormTrainConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 484);
|
||||
this.Controls.Add(this.labelAdditionalColor);
|
||||
this.Controls.Add(this.labelColor);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Controls.Add(this.panel9);
|
||||
this.Controls.Add(this.ParamsGroup);
|
||||
this.Name = "FormTrainConfig";
|
||||
this.Text = "FormTrainConfig";
|
||||
this.ParamsGroup.ResumeLayout(false);
|
||||
this.ParamsGroup.PerformLayout();
|
||||
this.groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericWeight)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).EndInit();
|
||||
this.panel9.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(933, 558);
|
||||
Controls.Add(labelAdditionalColor);
|
||||
Controls.Add(labelColor);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(panel9);
|
||||
Controls.Add(ParamsGroup);
|
||||
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
Name = "FormTrainConfig";
|
||||
Text = "FormTrainConfig";
|
||||
ParamsGroup.ResumeLayout(false);
|
||||
ParamsGroup.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericSpeed).EndInit();
|
||||
panel9.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
@ -14,7 +14,7 @@ where U : IMoveableObject
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T> GetCars => _collection.GetTrains();
|
||||
public IEnumerable<T> GetTrains => _collection.GetTrains();
|
||||
/// <summary>
|
||||
/// Ширина окна прорисовки
|
||||
/// </summary>
|
||||
|
@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace Laba1Loco
|
||||
{
|
||||
@ -34,11 +35,10 @@ namespace Laba1Loco
|
||||
File.Delete(filename);
|
||||
}
|
||||
StringBuilder data = new StringBuilder();
|
||||
foreach (KeyValuePair<string,
|
||||
TrainsGenericCollection<DrawingTrain, DrawningObjectTrain>> record in _trainStorages)
|
||||
foreach (KeyValuePair<string, TrainsGenericCollection<DrawingTrain, DrawningObjectTrain>> record in _trainStorages)
|
||||
{
|
||||
StringBuilder records = new StringBuilder();
|
||||
foreach (DrawingTrain elem in record.Value.GetCars)
|
||||
foreach (DrawingTrain elem in record.Value.GetTrains.Reverse())
|
||||
{
|
||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||
}
|
||||
@ -48,10 +48,10 @@ namespace Laba1Loco
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using FileStream fs = new FileStream(filename, FileMode.Create);
|
||||
byte[] info = new
|
||||
UTF8Encoding(true).GetBytes($"CarStorage{Environment.NewLine}{data}");
|
||||
fs.Write(info, 0, info.Length);
|
||||
using (StreamWriter sr = new StreamWriter(filename))
|
||||
{
|
||||
sr.Write($"TrainStorage{Environment.NewLine}{data}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
@ -65,53 +65,38 @@ namespace Laba1Loco
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string bufferTextFromFile = "";
|
||||
using (FileStream fs = new(filename, FileMode.Open))
|
||||
using (StreamReader sr = new(filename))
|
||||
{
|
||||
byte[] b = new byte[fs.Length];
|
||||
UTF8Encoding temp = new(true);
|
||||
while (fs.Read(b, 0, b.Length) > 0)
|
||||
string s = sr.ReadLine();
|
||||
if (s == null || s.Length == 0)
|
||||
return false;
|
||||
if (!s.StartsWith("TrainStorage"))//если нет такой записи, то это не те данные
|
||||
return false;
|
||||
_trainStorages.Clear();
|
||||
s = sr.ReadLine();
|
||||
while (s != null && s.Length != 0)
|
||||
{
|
||||
bufferTextFromFile += temp.GetString(b);
|
||||
}
|
||||
}
|
||||
var strs = bufferTextFromFile.Split(new char[] { '\n', '\r' },
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strs == null || strs.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!strs[0].StartsWith("CarStorage"))
|
||||
{
|
||||
//если нет такой записи, то это не те данные
|
||||
return false;
|
||||
}
|
||||
_trainStorages.Clear();
|
||||
foreach (string data in strs)
|
||||
{
|
||||
string[] record = data.Split(_separatorForKeyValue,
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CarsGenericCollection<DrawningCar, DrawningObjectCar>
|
||||
collection = new(_pictureWidth, _pictureHeight);
|
||||
string[] set = record[1].Split(_separatorRecords,
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
DrawningCar? car =
|
||||
elem?.CreateDrawningCar(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||
if (car != null)
|
||||
string[] record = s.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
s = sr.ReadLine();
|
||||
if (record.Length != 2)
|
||||
{
|
||||
if (!(collection + car))
|
||||
continue;
|
||||
}
|
||||
TrainsGenericCollection<DrawingTrain, DrawningObjectTrain> collection = new(_pictureWidth, _pictureHeight);
|
||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
DrawingTrain car = elem?.CreateDrawingTrain(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||
if (car != null)
|
||||
{
|
||||
return false;
|
||||
if (collection + car == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
_trainStorages.Add(record[0], collection);
|
||||
}
|
||||
_trainStorages.Add(record[0], collection);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user