Ejemplo n.º 1
0
        /// <summary>
        /// Tries to parse a command line.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="commandLine">The command line.</param>
        /// <param name="to">To.</param>
        /// <returns></returns>
        public static bool TryParseCommandLine <T>(string commandLine, out T to)
            where T : class, new()
        {
            if (commandLine == null)
            {
                throw new ArgumentNullException("commandLine");
            }

            return(CommandLineTokenizer <T> .TryParse(GetCommandlineWords(commandLine), new TokenizerArgs(), out to));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to parse a command line.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="commandLineArguments">The command line arguments.</param>
        /// <param name="to">To.</param>
        /// <returns></returns>
        public static bool TryParseCommandLine <T>(IList <string> commandLineArguments, out T to)
            where T : class, new()
        {
            if (commandLineArguments == null)
            {
                throw new ArgumentNullException("args");
            }

            EnsureItems(commandLineArguments, "commandLineArguments");

            return(CommandLineTokenizer <T> .TryParse(commandLineArguments, new TokenizerArgs(), out to));
        }