Exemple #1
0
 public static async Task Main(string[] args)
 {
     var config          = GetConfig(args);
     var services        = ConfigureServices();
     var serviceProvider = services.BuildServiceProvider();
     var myBot           = new MyPaintBot(config, serviceProvider.GetService <IPaintBotClient>(),
                                          serviceProvider.GetService <IHearBeatSender>(), serviceProvider.GetService <ILogger>());
     await myBot.Run(CancellationToken.None);
 }
Exemple #2
0
        public static Task Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            Console.CursorVisible  = false;
            var config          = GetConfig(args);
            var services        = ConfigureServices();
            var serviceProvider = services.BuildServiceProvider();
            var myBot           = new MyPaintBot(config, serviceProvider.GetService <IPaintBotClient>(),
                                                 serviceProvider.GetService <IHearBeatSender>(), serviceProvider.GetService <ILogger>());

            if (config.VisualMode == VisualMode.GUI)
            {
                using var game = new PaintBotGame(myBot);
                game.Run();
                return(Task.CompletedTask);
            }
            else
            {
                return(myBot.Run(CancellationToken.None));
            }
        }