mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Fix Nca exception message when a section doesn't exist
This commit is contained in:
parent
96b3fd670b
commit
98b6d7a346
3 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,7 @@
|
||||||
internal static class Messages
|
internal static class Messages
|
||||||
{
|
{
|
||||||
public static string DestSpanTooSmall => "Destination array is not long enough to hold the requested data.";
|
public static string DestSpanTooSmall => "Destination array is not long enough to hold the requested data.";
|
||||||
public static string NcaSectionMissing => "NCA section does not exist.";
|
public static string NcaSectionMissing => "NCA section {0} does not exist.";
|
||||||
public static string DestPathIsSubPath => "The destination directory is a subdirectory of the source directory.";
|
public static string DestPathIsSubPath => "The destination directory is a subdirectory of the source directory.";
|
||||||
public static string DestPathAlreadyExists => "Destination path already exists.";
|
public static string DestPathAlreadyExists => "Destination path already exists.";
|
||||||
public static string PartialPathNotFound => "Could not find a part of the path.";
|
public static string PartialPathNotFound => "Could not find a part of the path.";
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class Nca
|
||||||
|
|
||||||
private IStorage OpenSectionStorage(int index)
|
private IStorage OpenSectionStorage(int index)
|
||||||
{
|
{
|
||||||
if (!SectionExists(index)) throw new ArgumentException(nameof(index), Messages.NcaSectionMissing);
|
if (!SectionExists(index)) throw new ArgumentException(string.Format(Messages.NcaSectionMissing, index), nameof(index));
|
||||||
|
|
||||||
long offset = Header.GetSectionStartOffset(index);
|
long offset = Header.GetSectionStartOffset(index);
|
||||||
long size = Header.GetSectionSize(index);
|
long size = Header.GetSectionSize(index);
|
||||||
|
@ -796,7 +796,7 @@ public class Nca
|
||||||
|
|
||||||
private IStorage OpenNca0RawStorage(int index, bool openEncrypted)
|
private IStorage OpenNca0RawStorage(int index, bool openEncrypted)
|
||||||
{
|
{
|
||||||
if (!SectionExists(index)) throw new ArgumentException(nameof(index), Messages.NcaSectionMissing);
|
if (!SectionExists(index)) throw new ArgumentException(string.Format(Messages.NcaSectionMissing, index), nameof(index));
|
||||||
|
|
||||||
long offset = Header.GetSectionStartOffset(index) - 0x400;
|
long offset = Header.GetSectionStartOffset(index) - 0x400;
|
||||||
long size = Header.GetSectionSize(index);
|
long size = Header.GetSectionSize(index);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public static class NcaExtensions
|
||||||
|
|
||||||
public static Validity ValidateSectionMasterHash(this Nca nca, int index)
|
public static Validity ValidateSectionMasterHash(this Nca nca, int index)
|
||||||
{
|
{
|
||||||
if (!nca.SectionExists(index)) throw new ArgumentException(nameof(index), Messages.NcaSectionMissing);
|
if (!nca.SectionExists(index)) throw new ArgumentException(string.Format(Messages.NcaSectionMissing, index), nameof(index));
|
||||||
if (!nca.CanOpenSection(index)) return Validity.MissingKey;
|
if (!nca.CanOpenSection(index)) return Validity.MissingKey;
|
||||||
|
|
||||||
NcaFsHeader header = nca.GetFsHeader(index);
|
NcaFsHeader header = nca.GetFsHeader(index);
|
||||||
|
|
Loading…
Reference in a new issue