Exemplo n.º 1
0
        public static Parser <IAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return(BreakActionParser.GetParser(delayService, speechService)
                   .Or <IAction>(MetronomeActionParser.GetParser(audioService, delayService, loggerService))
                   .Or <IAction>(PrepareActionParser.GetParser(delayService, speechService))
                   .Or <IAction>(SayActionParser.GetParser(speechService))
                   .Or <IAction>(WaitActionParser.GetParser(delayService))
                   .Or <IAction>(DoNotAwaitActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                   .Or <IAction>(ParallelActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                   .Or <IAction>(SequenceActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService)));
        }
Exemplo n.º 2
0
        public static Parser <IAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return(BreakActionParser.GetParser(delayService, speechService)
                   .Or <IAction>(MetronomeActionParser.GetParser(audioService, delayService))
                   .Or <IAction>(PrepareActionParser.GetParser(delayService, speechService))
                   .Or <IAction>(SayActionParser.GetParser(speechService))
                   .Or <IAction>(WaitActionParser.GetParser(delayService))
                   .Or <IAction>(DoNotAwaitActionParser.GetParser(indentLevel, audioService, delayService, speechService))
                   .Or <IAction>(ParallelActionParser.GetParser(indentLevel, audioService, delayService, speechService))
                   .Or <IAction>(SequenceActionParser.GetParser(indentLevel, audioService, delayService, speechService)));
        }