private static void GameSuccessfullyCompletedEnding() { Console.Clear(); Program.PlaySound("../../sounds/game-completed.wav"); try { StreamReader gameEnding = new StreamReader("../../LogoGame/GameEnding.txt", Encoding.GetEncoding("UTF-8")); using (gameEnding) { string endingText = gameEnding.ReadToEnd(); Console.SetCursorPosition(0, 0); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(endingText); GameMenu.EndingGame(); } } catch (FileNotFoundException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The file specified in path was not found."); } catch (DirectoryNotFoundException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The specified path is invalid (for example, it is on an unmapped drive)."); } catch (ArgumentNullException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The given path is NULL\n and some method received a null argument!"); } catch (ArgumentException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Path is a zero-length string, contains only white space, or contains one or more invalid characters."); } catch (PathTooLongException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" The specified path, file name, or both exceed\n the system-defined maximum length." + "Path must be\n less than 248 characters, and file names\n must be less than 260 characters."); } catch (NotSupportedException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The given path is in an invalid format."); } catch (UnauthorizedAccessException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("UnauthorizedAccesException detected! The reasons may be the following:\n" + " - Path specified a file that is read-only.\n - This operation is not supported on the current platform.\n" + " - The caller does not have the required permission."); } catch (SecurityException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Sorry, but you does not have the required permission."); } catch (IOException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("An I/O (Input/Output) error occurred while opening the file."); } }