public static Config Parse(XElement xml) { if (xml == null || xml.Name != strConfig) { return(null); } var result = new Config(); result.Grammars = GrammarList.Parse(xml.Element(GrammarList.strGrammarList)); return(result); }
public static GrammarList Parse(XElement xml) { if (xml == null || xml.Name != strGrammarList) { return(null); } var result = new GrammarList(); foreach (var item in xml.Elements(Grammar.strGrammar)) { result.Add(Grammar.Parse(item)); } result.SelectedIndex = int.Parse(xml.Attribute(strSelectedIndex).Value); return(result); }