/// <summary> /// Entry point. /// </summary> /// <returns>Returns exit code.</returns> private static async Task <int> Main() { Console.WriteLine("\nCustom Http client."); Console.WriteLine("Created by Zherybor Ivan.\n"); try { var logger = new Logger(); var options = new OptionsSource(); var responseHandler = new ResponseHandler(); var requestHandler = new RequestHandler(new HttpClient()); var performer = new RequestPerformer(requestHandler, responseHandler, logger); var mainMenu = new MainMenu(performer, options, logger); return(await mainMenu.StartAsync()); } catch (Exception ex) { Console.WriteLine("Critical unhandled exception"); Console.WriteLine(ex); return(-1); } }
/// <summary> /// Entry point. /// </summary> /// <returns>Returns exit code.</returns> private static async Task <int> Main() { try { var options = new OptionsSource(_optionsFilePath); var logger = new Logger(); var client = new HttpClient { Timeout = new TimeSpan(0, 0, 10) }; var requestHandler = new RequestHandler(client); var responseHandler = new ResponseHandler(); var requestPerformer = new RequestPerformer(requestHandler, responseHandler, logger); var mainMenu = new MainMenu(requestPerformer, options, logger); return(await mainMenu.StartAsync()); } catch (Exception ex) { Console.WriteLine("Critical unhandled exception"); Console.WriteLine(ex); return(-1); } }
/// <summary> /// Entry point. /// </summary> /// <returns>Returns exit code.</returns> private static async Task <int> Main() { try { var logger = new Logger(); var options = new OptionsSource("options.json"); var performer = new RequestPerformer(new RequestHandler(new HttpClient()), new ResponseHandler(), logger); // ToDo: Null arguments should be replaced with correct implementations. var mainMenu = new MainMenu(performer, options, logger); return(await mainMenu.StartAsync()); } catch (Exception ex) { Console.WriteLine("Critical unhandled exception"); Console.WriteLine(ex); return(-1); } }
/// <summary> /// Entry point. /// </summary> /// <returns>Returns exit code.</returns> private static async Task <int> Main() { try { ILogger logger = new Logger(); IOptionsSource optionsSource = new OptionSource("options.json"); IRequestPerformer requestPerformer = new RequestPerformer( new RequestHandler(new HttpClient()), new ResponseHandler(), logger ); var mainMenu = new MainMenu(requestPerformer, optionsSource, logger); return(await mainMenu.StartAsync()); } catch (Exception ex) { Console.WriteLine("Critical unhandled exception"); Console.WriteLine(ex); return(-1); } }
/// <summary> /// Entry point. /// </summary> /// <returns>Returns exit code.</returns> private static async Task <int> Main() { try { var responseHandler = new ResponseHandler(); var requestHandler = new RequestHandler(new System.Net.Http.HttpClient() { Timeout = TimeSpan.FromSeconds(100) }); var logger = new Logging.Logger(); var performer = new RequestPerformer(requestHandler, responseHandler, logger); var options = new OptionsSource("options.json"); var mainMenu = new MainMenu(performer, options, logger); return(await mainMenu.StartAsync()); } catch (Exception ex) { Console.WriteLine("Critical unhandled exception"); Console.WriteLine(ex); return(-1); } }