From 070f4ee122a9691f80f4f4e047f39a86db6a6f2d Mon Sep 17 00:00:00 2001 From: Thog Date: Thu, 9 Jan 2020 20:42:43 +0100 Subject: [PATCH] Create and use InvalidFirmwarePackageException --- .../InvalidFirmwarePackageException.cs | 9 +++++++++ Ryujinx.HLE/FileSystem/Content/ContentManager.cs | 16 ++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs diff --git a/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs b/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs new file mode 100644 index 0000000000..bddd827a01 --- /dev/null +++ b/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs @@ -0,0 +1,9 @@ +using System; + +namespace Ryujinx.HLE.Exceptions +{ + class InvalidFirmwarePackageException : Exception + { + public InvalidFirmwarePackageException(string message) : base(message) { } + } +} diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs index b8fc12e146..a7490466db 100644 --- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs +++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs @@ -1,10 +1,9 @@ using LibHac; using LibHac.Fs; -using LibHac.FsService; using LibHac.FsSystem; using LibHac.FsSystem.NcaUtils; using LibHac.Ncm; -using Ryujinx.HLE.HOS.Font; +using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Services.Time; using Ryujinx.HLE.Utilities; using System; @@ -13,8 +12,6 @@ using System.IO; using System.IO.Compression; using System.Linq; -using static Ryujinx.Common.HexUtils; - namespace Ryujinx.HLE.FileSystem.Content { internal class ContentManager @@ -367,7 +364,7 @@ namespace Ryujinx.HLE.FileSystem.Content InstallFromCart(xci, temporaryDirectory); break; default: - throw new FormatException("Input file is not a valid firmware package"); + throw new InvalidFirmwarePackageException("Input file is not a valid firmware package"); } FinishInstallation(temporaryDirectory, registeredDirectory); @@ -523,7 +520,10 @@ namespace Ryujinx.HLE.FileSystem.Content return VerifyAndGetVersion(partition); } else - throw new InvalidDataException("Update not found in xci file."); + { + throw new InvalidFirmwarePackageException("Update not found in xci file."); + } + default: break; } @@ -684,7 +684,7 @@ namespace Ryujinx.HLE.FileSystem.Content } } - throw new InvalidDataException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}"); + throw new InvalidFirmwarePackageException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}"); } } else @@ -815,7 +815,7 @@ namespace Ryujinx.HLE.FileSystem.Content } } - throw new InvalidDataException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}"); + throw new InvalidFirmwarePackageException($"Firmware package contains unrelated archives. Please remove these paths: \n{extraNcas}"); } return systemVersion;