예제 #1
0
        static public void DisplayScores()
        {
            //2) Next, while in the method DisplayScores(), the file is validated through the ValidateFile() method from the FileReader class

            if (Validator.ValidateFile() == true)
            {                                     //If true, there's no problem.
            }
            else                                  //If there's an error with the file, it will display it to the user and prevent any further progress of the system.
            {
                Console.WriteLine("No hay archivo disponible, verifique que exista uno. ");
                Console.ReadKey();
                Environment.Exit(0);
            }
            List <Tuple <float, string> > sortedScores; //List of tuples holding a score and name per index



            sortedScores = ScoreSorting.SortScores(); //3) Afterwards, the method SortScores from this same class is called upon, and should return at the end
            //a list of sorted scores and names



            for (int i = 1; i < 4; i++)
            {
                Console.WriteLine(sortedScores[sortedScores.Count() - i].Item2 + " " + sortedScores[sortedScores.Count() - i].Item1);
                Console.WriteLine();
            }
            Console.ReadKey();
            return; //The top three scores are printed for the user to see.
        }
예제 #2
0
        static public void DisplayScores()
        {
            if (Validator.ValidateFile() == true) //Checks if there's a file with the proper name and path
            {                                     //If true, there's no problem.
            }
            else                                  //If there's an error with the file, it will display it to the user and prevent any further progress of the system.
            {
                Console.WriteLine("No hay archivo disponible, verifique que exista uno. ");
                Console.ReadKey();
                Environment.Exit(0);
            }
            List <Tuple <float, string> > sortedScores; //List of tuples holding a score and name per index

            sortedScores = ScoreSorting.SortScores();
            for (int i = 1; i < 4; i++)
            {
                Console.WriteLine(sortedScores[sortedScores.Count() - i].Item2 + " " + sortedScores[sortedScores.Count() - i].Item1);
                Console.WriteLine();
            }
            Console.ReadKey();
            return;
        }