예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
                }
            }
        }
예제 #4
0
        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();
                }
            }
        }
예제 #5
0
 public static int IntegerValue(this ScriptCommandParameter parameter)
 {
     return(Convert.ToInt32(parameter.Value));
 }