public static CommandStage Select <TStreamType>(this CommandStage stage, int index)
            where TStreamType : class, IStream
        {
            var streamId = stage.Command.StreamIdentifier <TStreamType>(index);

            return(stage.Select(streamId));
        }
        public static CommandStage WithInput <TStreamType>(this CommandStage command, string fileName, SettingsCollection settings)
            where TStreamType : class, IStream
        {
            command.Command.AddInput(fileName, settings);

            return(command.Select(command.Command.LastInputStream <TStreamType>()));
        }
        public static CommandStage Select(this CommandStage stage, StreamIdentifier streamId)
        {
            var streamIdList = new List <StreamIdentifier> {
                streamId
            };

            return(stage.Select(streamIdList));
        }
        public static CommandStage Select(this CommandStage stage, CommandInput resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            return(stage.Select(resource.GetStreamIdentifier()));
        }
        public static CommandStage Select(this CommandStage stage, params CommandStage[] stages)
        {
            if (stages == null || stages.Length == 0)
            {
                throw new ArgumentNullException("stages");
            }

            return(stage.Select(stages.ToList()));
        }
        public static CommandStage Select <TStreamType>(this CommandStage stage, CommandInput resource)
            where TStreamType : class, IStream
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            return(stage.Select(resource.GetStreamIdentifier <TStreamType>()));
        }
        public static CommandStage Select(this CommandStage stage, List <CommandStage> stages)
        {
            var streams = new List <StreamIdentifier>();

            foreach (var commandStage in stages)
            {
                if (commandStage.StreamIdentifiers == null)
                {
                    continue;
                }

                streams.AddRange(commandStage.StreamIdentifiers);
            }

            return(stage.Select(streams));
        }
        public static CommandStage WithInput <TStreamType>(this CommandStage command, List <string> files)
            where TStreamType : class, IStream
        {
            if (files == null || files.Count == 0)
            {
                throw new ArgumentException("Files cannot be null or empty.", "files");
            }

            var streamIds = files.Select(fileName =>
            {
                command.Command.AddInput(fileName);

                return(command.Command.LastInputStream <TStreamType>());
            }).ToList();

            return(command.Select(streamIds));
        }
        public static CommandStage Select(this CommandStage stage, int index)
        {
            var streamId = stage.Command.StreamIdentifier(index);

            return(stage.Select(streamId));
        }
        public static CommandStage WithInputNoLoad(this CommandStage command, string fileName)
        {
            command.Command.AddInputNoLoad(fileName);

            return(command.Select(command.Command.LastInputStream()));
        }
        public static CommandStage Select(this CommandStage stage, params StreamIdentifier[] streamIds)
        {
            var streamIdList = new List <StreamIdentifier>(streamIds);

            return(stage.Select(streamIdList));
        }