private void bSaveRules_Click(object sender, EventArgs e) { List <SerializedRule> ruleList = new List <SerializedRule>(); foreach (Rule rule in _rules) { SerializedRule sr = new SerializedRule(); sr.Serialize(rule); ruleList.Add(sr); } ProductionSet ps = new ProductionSet(ruleList, _symbols); SaveXML(ps); }
private void bLoadRules_Click(object sender, EventArgs e) { ProductionSet ps = (ProductionSet)LoadXML <ProductionSet>(); if (ps == null) { return; } List <Rule> rules = new List <Rule>(); foreach (SerializedRule serializedRule in ps.Rules) { rules.Add(serializedRule.Deserialize()); } _rules = rules; RefreshListBox(lBRules, rules); _symbols = ps.Symbols; RefreshListBox(lBSymbols, _symbols); RefreshListBox(cBSymbols, _symbols); }