public void Run(string[] args) { // Exit App if incorrect params are provided if (!_validator.ValidateArgs(args)) { return; } // Read File and get list of names var listOfNames = _fileOperations.ReadFile(args[0]); // Validate Names _validator.ValidateNames(listOfNames); // Sort Names var sortedNames = _nameSorter.SortNames(listOfNames); // Write to screen _screenWriter.WriteListOfNamesToConsole(sortedNames); // Write to file var writeToFilePath = _config["OutputFilePath"]; _fileOperations.WriteNamesToFile(writeToFilePath, sortedNames); _screenWriter.WriteStringToConsole(Content.WriteToFileComplete(writeToFilePath)); _screenWriter.ShowExitMessageOnConsole(Content.ExitMessage); }
public async Task <bool> Get() { bool isfilecreated = true; string path = @_hostingEnvironment.WebRootPath + "\\InputFile\\Weather.txt"; //string path = @"D:\\WeatherData\\WeatherData\\WeatherData\\wwwroot\\InputFile\\weather.txt"; try { IList <City> cities = _file.ReadFile(path); foreach (City c in cities) { dynamic res = await _weather.GetWeatherDetailsAsync(c.CityId); isfilecreated = await _file.WriteFile(c, _hostingEnvironment, res); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(isfilecreated); }