public static void Main() { ServiceProvider _serviceProvider = ConfigureServiceProvider(); FileCommandParser commandParser = _serviceProvider.GetRequiredService <FileCommandParser>(); AuthorizeCommandParser authorizeParser = _serviceProvider.GetRequiredService <AuthorizeCommandParser>(); Console.WriteLine("Runned"); Authorize(authorizeParser); while (true) { ReadUserCommand(commandParser); } }
private static void Authorize(AuthorizeCommandParser authorizeParser) { Console.WriteLine("Authorize to use the program."); { try { HandleInput(authorizeParser); } catch (Exception ex) { Console.WriteLine(ex.Message); Authorize(authorizeParser); } } }