Esempio n. 1
0
        public static void Execute(ProgramExecutionOptions options)
        {
            if (ProgramUtil.ShowHelpIfNeeded(options))
            {
                return;
            }

            if (options.ParsedArguments.Count > 0)
            {
                var programName = options.ParsedArguments[0].Value;
                var program     = Shell.FindProgramByCommand(programName);
                if (program == null)
                {
                    var msg =
                        "'{0}' is not a valid program. You can use 'help' to see help for all programs or 'help <program_name>' to see help about a specific program";
                    msg = TextUtil.ApplyNGUIColor(msg, Constants.Colors.Error);
                    TerminalUtil.ShowText(msg);
                }
                else
                {
                    ShowHelpFor(program);
                    ShowProgramsUsage();
                }
            }
            else
            {
                TerminalUtil.StartTextBatch();

                var programs = ProgramUtil.GetAvailablePrograms(DataHolder.DeviceData.CurrentDevice);
                for (int i = 0; i < programs.Count; i++)
                {
                    var program = programs[i];
                    ShowHelpFor(program);
                }

                ShowProgramsUsage();

                TerminalUtil.EndTextBatch();
            }
        }
Esempio n. 2
0
        public static bool HasProgram(HashDevice device, ProgramType programType)
        {
            var programs = ProgramUtil.GetAvailablePrograms(device);

            return(SList.Exists(programs, p => p.ProgramType == programType));
        }