Esempio n. 1
0
        public IEnumerable<ICommandLineElement> Parse(string commandLine)
        {
            var parser = new StringCommandLineParser();

            Result<string, ICommandLineElement> result = parser.All(commandLine);
            while (result != null)
            {
                yield return result.Value;

                result = parser.All(result.Rest);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///   Parses the command line
        /// </summary>
        /// <param name="commandLine"> The command line to parse </param>
        /// <returns> The command line elements that were found </returns>
        private static string ParseCommandLine(string commandLine)
        {
            var parser = new StringCommandLineParser();
            var result = parser.All(commandLine);

            while (result != null)
            {
                var element = result.Value as DefinitionElement;

                if (element != null && element.Key.ToLowerInvariant() == "task")
                {
                    return(element.Value.ToLowerInvariant().Trim());
                }

                result = parser.All(result.Rest);
            }

            return(null);
        }
Esempio n. 3
0
        /// <summary>
        ///   Parses the command line
        /// </summary>
        /// <param name="commandLine"> The command line to parse </param>
        /// <returns> The command line elements that were found </returns>
        private static Service?ParseCommandLine(string commandLine)
        {
            var parser = new StringCommandLineParser();
            var result = parser.All(commandLine);

            while (result != null)
            {
                var element = result.Value as DefinitionElement;

                if (element != null && element.Key.ToLowerInvariant() == "instance")
                {
                    return((Service)Enum.Parse(typeof(Service), element.Value, true));
                }

                result = parser.All(result.Rest);
            }

            return(null);
        }