public void loadClauses() { clear_boxes(); objects = new List <Clause>(); objects.Clear(); try { FileStream s = File.Open("Clauses.txt", FileMode.Open); while (true) { try { BinaryFormatter b = new BinaryFormatter(); obj = (Clause)b.Deserialize(s); objects.Add(new Clause(obj)); } catch { break; } } s.Close(); } catch { FileStream s = File.Open("Clauses.txt", FileMode.Create); s.Close(); } objects.Sort((x, y) => x.get_name().CompareTo(y.get_name())); foreach (Clause clause in objects) { Search_comboBox.Items.Add(clause.get_name()); comboBox1.Items.Add(clause.get_name()); comboBox2.Items.Add(clause.get_name()); comboBox3.Items.Add(clause.get_name()); comboBox4.Items.Add(clause.get_name()); comboBox5.Items.Add(clause.get_name()); comboBox6.Items.Add(clause.get_name()); comboBox7.Items.Add(clause.get_name()); comboBox8.Items.Add(clause.get_name()); comboBox9.Items.Add(clause.get_name()); comboBox10.Items.Add(clause.get_name()); comboBox11.Items.Add(clause.get_name()); comboBox12.Items.Add(clause.get_name()); comboBox13.Items.Add(clause.get_name()); comboBox14.Items.Add(clause.get_name()); comboBox15.Items.Add(clause.get_name()); comboBox16.Items.Add(clause.get_name()); comboBox17.Items.Add(clause.get_name()); comboBox18.Items.Add(clause.get_name()); comboBox19.Items.Add(clause.get_name()); comboBox20.Items.Add(clause.get_name()); comboBox21.Items.Add(clause.get_name()); comboBox22.Items.Add(clause.get_name()); comboBox23.Items.Add(clause.get_name()); comboBox24.Items.Add(clause.get_name()); comboBox24.Items.Add(clause.get_name()); comboBox26.Items.Add(clause.get_name()); comboBox27.Items.Add(clause.get_name()); comboBox28.Items.Add(clause.get_name()); comboBox29.Items.Add(clause.get_name()); comboBox30.Items.Add(clause.get_name()); comboBox31.Items.Add(clause.get_name()); comboBox32.Items.Add(clause.get_name()); comboBox33.Items.Add(clause.get_name()); comboBox34.Items.Add(clause.get_name()); comboBox35.Items.Add(clause.get_name()); } }
public Clause(Clause obj) { this.name = obj.name; this.description = obj.description; this.wording = obj.wording; }