Ejemplo n.º 1
0
        public static string RequestFileName()
        {
            string fileName;

            do
            {
                try
                {
                    Console.WriteLine("Enter the file name with extension:");
                    fileName = Console.ReadLine();

                    var extension = Path.GetExtension(fileName);
                    FileController.ValidateFile(fileName, extension);
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine($"Error: {e.Message}");
                    continue;
                }

                break;
            } while (true);

            return(fileName);
        }
Ejemplo n.º 2
0
        public static string RequestFileName()
        {
            string fileName;

            do
            {
                try
                {
                    Console.WriteLine("Enter the file name:");
                    fileName = Console.ReadLine();

                    FileController.ValidateFile(fileName, FileController.READING_EXTENSION);
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine($"Error: {e.Message}");
                    continue;
                }

                break;
            } while (true);

            return(fileName);
        }