internal static List <PhotoInput> TakeUserInput(string autoUrl = null) { Console.WriteLine(Resource.inputUrl); List <string> urlCollection; if (String.IsNullOrEmpty(autoUrl)) { var config = AutoConfigProvider.GetValue(AutoConfigType.Url); if (config.Value != null) { urlCollection = config.Value; } else { urlCollection = new List <string>(); string url; while (((url = Console.ReadLine()) != null) && (url != "")) { urlCollection.Add(url); } } } else { urlCollection = new List <string> { autoUrl }; } if (urlCollection.Count == 0) { throw new PhotoInputException("Invalid url provided"); } var photoInputCollection = urlCollection.Select(cUrl => new PhotoInput { Url = cUrl }).ToList(); Console.Clear(); return(photoInputCollection); }
public virtual void DoStackCall() { List <PhotoInput> userInput; userInput = Convert.ToBoolean(AutoConfigProvider.GetValue(AutoConfigType.Auto).Value) ? Photo.TakeUserInput(AutoUrl) : Photo.TakeUserInput(); var userInputCount = userInput.Count; for (int i = 0; i < userInputCount; i++) { try { Console.Clear(); Console.Write(Resource.readingUrlFrom, i + 1, userInputCount); Photo.DoDownload(DoImageDownload(userInput[i])); } catch (Exception ex) { Console.WriteLine(ex.Message); } } Console.WriteLine(); }