public XmlScriptCommand(XmlNode node) { this.OriginalText = node.OuterXml; FullName = node.Name; Parameters = new ScriptCommandParameters(); foreach (XmlAttribute attribute in node.Attributes) { var parameter = new ScriptCommandParameter(name: attribute.Name, value: attribute.Value); Parameters.Add(parameter); } InnerCommands = ScriptCommandList.FromText(node.InnerXml); }
private static IEnumerable <ScriptCommandParameter> ParseParameters(string parameters) { //TODO: Fix this ugly code parameters = parameters.Trim(); while (parameters.Length > 0) { foreach (var capture in _parametersRegex.Match(parameters).Captures) { var parameterMatch = _parameterRegex.Match(capture.ToString()); var name = parameterMatch.Groups["Name"].Value; var value = parameterMatch.Groups["Value"].Value; var parameter = new ScriptCommandParameter(name, value); yield return(parameter); parameters = parameters.Substring(parameterMatch.Value.Length).TrimStart(); } } }
private static IEnumerable<ScriptCommandParameter> ParseParameters(string parameters) { //TODO: Fix this ugly code parameters = parameters.Trim(); while (parameters.Length > 0) { foreach (var capture in _parametersRegex.Match(parameters).Captures) { var parameterMatch = _parameterRegex.Match(capture.ToString()); var name = parameterMatch.Groups["Name"].Value; var value = parameterMatch.Groups["Value"].Value; var parameter = new ScriptCommandParameter(name, value); yield return parameter; parameters = parameters.Substring(parameterMatch.Value.Length).TrimStart(); } } }
public static int IntegerValue(this ScriptCommandParameter parameter) { return(Convert.ToInt32(parameter.Value)); }