private static IEnumerable <XmlGeneratorAction> ReadActionsList(XElement actionsList) { if (actionsList == null) { yield break; } foreach (var action in actionsList.Descendants("action")) { var xmlAction = new XmlGeneratorAction(); var typeElement = action.Element("type"); if (typeElement != null) { xmlAction.ActionType = typeElement.Value; } else { throw new XmlSchemaException("Type element not present in template <action> file"); } xmlAction.Parameters = ReadActionParameterList(action.Element("parameters")); yield return(xmlAction); } }
private static XElement GenerateAction(XmlGeneratorAction action) { return(new XElement("action", new XElement("type", action.ActionType), new XElement("parameters", action.Parameters.Select(x => new XElement("parameter", x.Value, new XAttribute("name", x.Key))) ) )); }
private static XElement GenerateAction(XmlGeneratorAction action) { return new XElement("action", new XElement("type", action.ActionType), new XElement("parameters", action.Parameters.Select(x => new XElement("parameter", x.Value, new XAttribute("name", x.Key))) ) ); }
private static IEnumerable<XmlGeneratorAction> ReadActionsList(XElement actionsList) { if (actionsList == null) yield break; foreach (var action in actionsList.Descendants("action")) { var xmlAction = new XmlGeneratorAction(); var typeElement = action.Element("type"); if (typeElement != null) xmlAction.ActionType = typeElement.Value; else throw new XmlSchemaException("Type element not present in template <action> file"); xmlAction.Parameters = ReadActionParameterList(action.Element("parameters")); yield return xmlAction; } }