static async Task Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var spotifyClientConfig = configuration.GetSection(nameof(SpotifyClientConfiguration)).Get <SpotifyClientConfiguration>(); var spotifyAuthConfig = configuration.GetSection(nameof(SpotifyAuthenticationConfiguration)).Get <SpotifyAuthenticationConfiguration>(); Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); var cts = new CancellationTokenSource(); Console.CancelKeyPress += (_, e) => { e.Cancel = true; // prevent the process from terminating. cts.Cancel(); }; var cache = new MemoryCache(new MemoryCacheOptions()); var logger = new LoggerFactory(); var authClient = new SpotifyAuthenticationCodeClient(spotifyAuthConfig, cache, logger); //var authClient = new SpotifyCredentialClient(spotifyAuthConfig, cache, logger); var client = new SpotifyApiClient(spotifyClientConfig, authClient, logger); var service = new SpotifyPlaylistService(client, logger); var generator = new ConsoleMenuGenerator(service, cache); await generator.GenerateMainMenu(cts.Token); }
public ConsoleMenuGenerator(SpotifyPlaylistService service, IMemoryCache cache) { _cache = cache; _service = service; }