Exemplo n.º 1
0
        private static void AddNormalCommands(Cli cli, ILog log, IStorage storage, ITwitterGateway twitter)
        {
            var credentials   = new KeyStored <Credentials>(storage, "Credentials", () => Credentials.Invalid);
            var tweetTasks    = new KeyStored <ScheduledTasks>(storage, "TweetTasks", () => new ScheduledTasks());
            var likeTasks     = new KeyStored <ScheduledTasks>(storage, "LikeTasks", () => new ScheduledTasks());
            var tweet         = new Tweet(twitter, log);
            var like          = new Like(twitter, log);
            var automatonData = new KeyStored <RandomLikeAutomatonData>(storage, "AutomatonData", () => new RandomLikeAutomatonData());
            var likeAutomaton = new RandomLikeAutomaton(automatonData, likeTasks, like, twitter, log);
            var rawCommands   = new List <Command>
            {
                new SetupCommand(credentials, log),
                new ViewCredentials(credentials, log),
                new ScheduleTweet(tweetTasks, tweet, log),
                new ViewTasks(tweetTasks, log),
                new Run(tweetTasks, likeTasks, cli, likeAutomaton, log),
                new Cancel(tweetTasks, log),
                tweet,
                like,
                new SetMaxLikes(automatonData, twitter, log)
            };

            cli.AddCommands(rawCommands
                            .Select(x => new WithDisplayedUsername(log, credentials, x))
                            .Concat(new List <ICommand> {
                new Help(rawCommands.ToDictionary(x => x.Name, x => x), log)
            })
                            .ToArray());
        }
Exemplo n.º 2
0
        public static Cli Init(ILog log, IStorage storage, ITwitterGateway twitter)
        {
            var cli = new Cli(log);

            AddNormalCommands(cli, log, storage, twitter);
            return(cli);
        }
Exemplo n.º 3
0
 public RandomLikeAutomaton(IStored <RandomLikeAutomatonData> data, IStored <ScheduledTasks> tasks, Like like, ITwitterGateway twitter, ILog log)
 {
     _data    = data;
     _tasks   = tasks;
     _like    = like;
     _twitter = twitter;
     _log     = log;
 }
Exemplo n.º 4
0
 public Like(ITwitterGateway twitter, ILog log)
 {
     _twitter = twitter;
     _log     = log;
 }
Exemplo n.º 5
0
 public SetMaxLikes(IStored <RandomLikeAutomatonData> data, ITwitterGateway twitter, ILog log)
 {
     _data    = data;
     _twitter = twitter;
     _log     = log;
 }
Exemplo n.º 6
0
 public Tweet(ITwitterGateway twitter, ILog log)
 {
     _twitter = twitter;
     _log     = log;
 }