Пример #1
0
        public string GetParameter(string command)
        {
            CLICommand cliCommand = Commands.Find(x => x.CheckCommand(command));

            if (cliCommand != null)
            {
                return(cliCommand.Parameter);
            }

            return(null);
        }
Пример #2
0
        public string GetParameter(string command)
        {
            CLICommand cliCommand = Commands.Find(x => command.Equals(x.Command, StringComparison.InvariantCultureIgnoreCase));

            if (cliCommand != null)
            {
                return(cliCommand.Parameter);
            }

            return(null);
        }
Пример #3
0
        public bool ParseCommands()
        {
            try
            {
                CLICommand lastCommand = null;

                foreach (string argument in Arguments)
                {
                    if (lastCommand == null || argument[0] == '-')
                    {
                        CLICommand command = new CLICommand();

                        if (argument[0] == '-')
                        {
                            command.IsCommand = true;
                            command.Command   = argument.Substring(1);
                            lastCommand       = command;
                        }
                        else
                        {
                            command.Command = argument;
                        }

                        Commands.Add(command);
                    }
                    else
                    {
                        lastCommand.Parameter = argument;
                        lastCommand           = null;
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                DebugHelper.WriteException(e);
            }

            return(false);
        }
Пример #4
0
        public bool ParseCommands()
        {
            try
            {
                CLICommand lastCommand = null;

                foreach (string argument in Arguments)
                {
                    if (lastCommand == null || argument[0] == '-')
                    {
                        CLICommand command = new CLICommand();

                        if (argument[0] == '-')
                        {
                            command.IsCommand = true;
                            command.Command = argument.Substring(1);
                            lastCommand = command;
                        }
                        else
                        {
                            command.Command = argument;
                        }

                        Commands.Add(command);
                    }
                    else
                    {
                        lastCommand.Parameter = argument;
                        lastCommand = null;
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                DebugHelper.WriteException(e);
            }

            return false;
        }