/// <summary> /// Запись в файл. /// </summary> /// <param name="printer">Файловый принтер.</param> private void FilePrint(IFileSchedulePrinter <Meeting> printer) { try { if (_schedule.Count() == 0) { Console.WriteLine("Расписание пусто!"); } else { string path; Console.WriteLine("Введите дату"); DateTime day = DateTime.Parse(Console.ReadLine()); Console.WriteLine(@"Директория по умолчанию: C:\Users\user\Documents\Visual Studio 2015\" + "\r\n" + @"\Projects\ConsoleApplication\ConsoleApplication\bin\Debug\Output"); Console.Write("Сохранить в директорию по умолчанию? (да / нет): "); string key = Console.ReadLine(); switch (key) { case "да": { if (!Directory.Exists(@"Output\")) { Directory.CreateDirectory(@"Output\"); } path = @"Output\" + day.ToShortDateString() + ".txt"; _schedule.FilePrint(printer, day, path); break; } case "нет": { Console.Write("Введите путь: "); path = Console.ReadLine(); _schedule.FilePrint(printer, day, path); break; } default: Console.WriteLine("Введены некорректные данные!"); break; } } } catch (FormatException) { Console.WriteLine("Введены некорректные данные!"); } catch (Exception e) { Console.WriteLine(e.Message); } }