Esempio n. 1
0
        private static string GetActualResult(string inputLines)
        {
            var tempFileName = Path.GetTempFileName();

            using (var writer = new StreamWriter(tempFileName))
                writer.Write(inputLines);

            var actualResult = GetActualResult();

            try
            {
                File.Delete(tempFileName);
            }
            catch (IOException) { }

            return(actualResult);

            string GetActualResult()
            {
                using (var reader = new StreamReader(tempFileName))
                {
                    var(labyrinth, start, finish) = DataParser.GetInputData(reader.ReadLine);
                    var resultRoute = BreadthFirstSearch.GetRoute(labyrinth, start, finish);
                    return(DataParser.ResultGenerate(resultRoute));
                }
            }
        }