Пример #1
0
 public EngineBuilder()
 {
     _fileSystem          = Dummy.Of <IFileSystem>();
     _commandFactory      = new StubCommandFactory(new Command("dummy", passThroughArgs => passThroughArgs));
     _commandLineExecutor = Dummy.Of <ICommandLineExecutor>();
     _variableHelper      = new FakePassthroughVariableHelper();
 }
Пример #2
0
        public static StringBuilder ParseString(this StringBuilder sb, IVariableHelper helper,
                                                CommandParser parser, ReportData data = null)
        {
            int varPosition;
            var startIndex = 0;

            do
            {
                const string chars = "$%&";
                var          anyOf = chars.ToCharArray();

                varPosition = sb.IndexOfAny(anyOf, startIndex);
                if (varPosition == -1)
                {
                    continue;
                }

                //// Is it a valid variable?
                if (helper.GetDelegate(sb.Substring(varPosition, 2)).IsNotNull())
                {
                    sb.ReplaceFirst(sb.Substring(varPosition, 2), parser.ParseVariable(sb.Substring(varPosition, 2), data));
                }

                startIndex = varPosition + 1;
            }while (varPosition != -1);

            return(sb);
        }
Пример #3
0
 public CommandManager(IVariableHelper variableHelper, [Named("CommandHelper")] IHelper <Action> commandHelper,
                       ICommandRepository commandRepository, ICommandInitializer commandInitializer)
 {
     VariableHelper     = variableHelper;
     CommandHelper      = commandHelper;
     CommandRepository  = (CommandRepository)commandRepository;
     CommandInitializer = (CommandInitializer)commandInitializer;
 }
Пример #4
0
 public Engine(IFileSystem fileSystem, ICommandFactory commandFactory, ICommandLineExecutor commandLineExecutor,
               IVariableHelper variableHelper, ILogger logger, ISplashScreen splashScreen)
 {
     _fileSystem          = fileSystem;
     _commandFactory      = commandFactory;
     _commandLineExecutor = commandLineExecutor;
     _variableHelper      = variableHelper;
     _logger       = logger;
     _splashScreen = splashScreen;
 }
Пример #5
0
 public EngineBuilder WithVariableHelper(IVariableHelper variableHelper)
 {
     _variableHelper = variableHelper;
     return(this);
 }
Пример #6
0
 public CommandParser(IVariableHelper helper, ICommandManager commandManager)
     : base(commandManager)
 {
     Helper = helper;
 }