public ZoneForm(Zone zone) { Zone = zone; InitializeComponent(); ScriptPanel.Controls.Add(_scriptBox); StepTextBox.Text = zone.NumSteps.ToString(CultureInfo.InvariantCulture); LayerComboBox.Text = $"Layer: {zone.Layer}"; _scriptBox.Text = zone.Function; _scriptBox.Dock = DockStyle.Fill; PositionLabel.Text = $"(X: {zone.X}, Y: {zone.Y})"; }
/// <summary> /// Creates a zone from a filestream. /// </summary> /// <param name="reader">The System.IO.BinrayReader to use.</param> /// <returns>A zone object.</returns> public static Zone FromBinary(BinaryReader reader) { Zone zone = new Zone { _x1 = reader.ReadInt16(), _y1 = reader.ReadInt16(), _x2 = reader.ReadInt16(), _y2 = reader.ReadInt16(), Layer = reader.ReadInt16(), NumSteps = reader.ReadInt16() }; // read header: reader.ReadBytes(4); // read function: short length = reader.ReadInt16(); zone.Function = new string(reader.ReadChars(length)); return zone; }