Exemplo n.º 1
0
        /// <summary>
        /// вывести результат в консоль и в файл excel,
        /// если это указано в опциях
        /// </summary>
        /// <param name="result"></param>
        private static void OutputResult(ISimulationResult result)
        {
            Console.WriteLine();
            //выведем на консоль результаты
            foreach (string str in result.ToText())
            {
                Console.WriteLine(str);
                logger.LogInformation(str);
            }

            //проверим, указан ли файл для вывода в Excel
            logger.LogInformation("Creating Excel output file");
            FileParam excelFile = configRoot.GetSection("output").Get <FileParam>();

            if (FileParam.IsEmpty(excelFile))
            {
                string msg = "Excel output file not specified in config file and thus won't be generated";
                logger.LogWarning(msg);
                Console.WriteLine(msg);
                return;
            }
            result.ToExcel(excelFile.fileName);
            logger.LogInformation("Excel output file created");
        }