private static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine(HelpMessage); return; } if (!File.Exists(args[0])) { Console.Write(string.Format(FileNotFound, args[0])); return; } using (var fileStream = File.OpenRead(args[0])) { var dataProvider = new StreamFootbalDataProvider(); var solutionFinder = new MinimalDifferenceInGoalsTeamFinder(); var result = solutionFinder.Find(dataProvider.ReadData(fileStream)); if (result == null) { Console.Write(ResultNotFoundMessage); } else { Console.WriteLine(string.Format("Result! Team Name: {0}, Scored Goals: {1}, Lost Goals: {2}", result.Name, result.ScoredGoals, result.LostGoals)); } } Console.ReadKey(); }
private static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine(HelpMessage); return; } if (!File.Exists(args[0])) { Console.Write(string.Format(FileNotFound, args[0])); return; } using (var fileStream = File.OpenRead(args[0])) { var dataProvider = new StreamFootbalDataProvider(); var solutionFinder = new MinimalDifferenceInGoalsTeamFinder(); var result = solutionFinder.Find(dataProvider.ReadData(fileStream)); if (result == null) { Console.Write(ResultNotFoundMessage); } else { Console.WriteLine(string.Format("Result! Team Name: {0}, Scored Goals: {1}, Lost Goals: {2}", result.Name, result.ScoredGoals, result.LostGoals)); } } Console.ReadKey(); }