Пример #1
0
        [STAThread] // Need to be STA to use OLE (clipboard) and WPF
        static int Main(string[] args)
        {
            ExitCode result = ExitCode.GeneralFailure;

            CommandLineParser parser = new CommandLineParser(FlexServiceProvider.Services.GetService <IFileService>());

            parser.Parse(args);

            IArgumentProvider argumentProvider = ArgumentSettingsProvider.Create(parser, FlexServiceProvider.Services.GetService <IConfigurationManager>(), FlexServiceProvider.Services.GetService <IFileService>());

            using (ITaskService taskService = XFileTaskService.Create())
            {
                ConsoleTaskExecution execution = new ConsoleTaskExecution(argumentProvider, taskService.TaskRegistry);
                result = execution.ExecuteTask();
            }

            return((int)result);
        }
Пример #2
0
        protected override ExitCode ExecuteInternal()
        {
            string input = null;

            do
            {
                _consoleService.Write(_prompt);
                input = Environment.ExpandEnvironmentVariables(_consoleService.ReadLine().Trim());
                if (s_QuitCommands.Contains(input, StringComparer.OrdinalIgnoreCase))
                {
                    break;
                }
                CommandLineParser parser = new CommandLineParser(GetService <IFileService>());
                parser.Parse(Strings.SplitCommandLine(input).ToArray());
                IArgumentProvider    argumentProvider = ArgumentSettingsProvider.Create(parser, GetService <IConfigurationManager>(), GetService <IFileService>());
                ConsoleTaskExecution execution        = new ConsoleTaskExecution(argumentProvider, _registry);
                execution.ExecuteTask();
            } while (true);

            return(ExitCode.Success);
        }