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); }
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)); } }