public void openProject(Stream stream) { if (stream.Length == 0) { return; } IFormatter formatter = new BinaryFormatter(); My_Picture pict = (My_Picture)formatter.Deserialize(stream); info = pict.info; stream.Close(); if ((info != null) && (info.IsCorrect() == true)) { foreach (My_Figure fig in pict.FigureList) { fig.Core = core; if (fig is My_Port) { (fig as My_Port).TextLabel.Core = core; } } pict.core = core; this.figureList = pict.FigureList; } else { if (info != null) { core.Picture.openVHDLFile(info.VHDLFileName, info.Entity.name); } } if (core != null) { core.History.ClearHistory(); core.History.add(this); core.History.SetAsSaved(); } }
private void buttonOk_Click(object sender, EventArgs e) { EntityDrawningInfo info = new EntityDrawningInfo(); if (String.IsNullOrEmpty(textBoxVHDLFile.Text)) { MessageBox.Show("You Must Set VHDL File", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (String.IsNullOrEmpty(textBoxProjectFile.Text)) { MessageBox.Show("You Must Set Project File", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (String.IsNullOrEmpty((string)comboBoxEntity.SelectedItem)) { MessageBox.Show("You Must Set Entity Name", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string name = (string)comboBoxEntity.SelectedItem; foreach (vhdEntity entity in parser.entities) { if (entity.name.Equals(name)) { info.Entity = entity; break; } } info.ProjectFileName = textBoxProjectFile.Text; info.VHDLFileName = textBoxVHDLFile.Text; this.EntityDrawningInfo = info; Close(); }