diff --git a/src/hactoolnet/EnumStrings.cs b/src/hactoolnet/EnumStrings.cs index a154ff17..bb21681f 100644 --- a/src/hactoolnet/EnumStrings.cs +++ b/src/hactoolnet/EnumStrings.cs @@ -72,6 +72,19 @@ namespace hactoolnet }; } + public static string Print(this XciPartitionType value) + { + return value switch + { + XciPartitionType.Update => nameof(XciPartitionType.Update), + XciPartitionType.Normal => nameof(XciPartitionType.Normal), + XciPartitionType.Secure => nameof(XciPartitionType.Secure), + XciPartitionType.Logo => nameof(XciPartitionType.Logo), + XciPartitionType.Root => nameof(XciPartitionType.Root), + _ => value.ToString() + }; + } + public static string Print(this Validity value) { return value switch diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index 21586cb5..b3926b05 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -189,11 +189,11 @@ namespace hactoolnet foreach (SwitchFsNca nca in title.Ncas) { - ctx.Logger.LogMessage($" {nca.Nca.Header.ContentType.ToString()}"); + ctx.Logger.LogMessage($" {nca.Nca.Header.ContentType.Print()}"); Validity validity = nca.VerifyNca(ctx.Logger, true); - ctx.Logger.LogMessage($" {validity.ToString()}"); + ctx.Logger.LogMessage($" {validity.Print()}"); } } catch (Exception ex) @@ -256,7 +256,7 @@ namespace hactoolnet foreach (SwitchFsNca nca in sdfs.Ncas.Values.OrderBy(x => x.NcaId)) { - table.AddRow(nca.NcaId, nca.Nca.Header.ContentType.ToString(), nca.Nca.Header.TitleId.ToString("X16")); + table.AddRow(nca.NcaId, nca.Nca.Header.ContentType.Print(), nca.Nca.Header.TitleId.ToString("X16")); } return table.Print(); diff --git a/src/hactoolnet/ProcessXci.cs b/src/hactoolnet/ProcessXci.cs index 310daba4..10d61aa7 100644 --- a/src/hactoolnet/ProcessXci.cs +++ b/src/hactoolnet/ProcessXci.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using System.Linq; using System.Text; using LibHac; @@ -155,8 +154,9 @@ namespace hactoolnet PrintPartition(sb, colLen, xci.OpenPartition(XciPartitionType.Root), XciPartitionType.Root); - foreach (XciPartitionType type in Enum.GetValues(typeof(XciPartitionType))) + for (int i = 0; i <= (int)XciPartitionType.Root; i++) { + var type = (XciPartitionType)i; if (type == XciPartitionType.Root || !xci.HasPartition(type)) continue; XciPartition partition = xci.OpenPartition(type); @@ -170,7 +170,7 @@ namespace hactoolnet { const int fileNameLen = 57; - sb.AppendLine($"{type.ToString()} Partition:{partition.HashValidity.GetValidityString()}"); + sb.AppendLine($"{type.Print()} Partition:{partition.HashValidity.GetValidityString()}"); PrintItem(sb, colLen, " Magic:", partition.Header.Magic); PrintItem(sb, colLen, " Offset:", $"{partition.Offset:x12}"); PrintItem(sb, colLen, " Number of files:", partition.Files.Length);