internal static NintendoContentFileSystemInfo GetReplacedNcaInfo(NintendoContentArchiveReader ncaReader, string descFilePath, EntryReplaceRule replaceRule) { NintendoContentFileSystemInfo commonNcaInfo = ArchiveReconstructionUtils.GetCommonNcaInfo(ncaReader); commonNcaInfo.keyAreaEncryptionKeyIndex = ncaReader.GetKeyIndex(); commonNcaInfo.isProdEncryption = false; if (descFilePath != null) { NintendoContentAdfReader.RetrieveInfoFromDesc(ref commonNcaInfo, descFilePath); } else if (replaceRule != null && commonNcaInfo.contentType == (byte)0) { throw new Exception("Replacing 'Program' content needs desc file."); } for (int fsIndex = 0; fsIndex < commonNcaInfo.numFsEntries; ++fsIndex) { string str = string.Format("fs{0}", (object)fsIndex); if (replaceRule != null && replaceRule.Path.StartsWith(str)) { EntryReplaceRule replaceRule1 = replaceRule; replaceRule1.Path = replaceRule1.Path.Substring(str.Length + 1); commonNcaInfo.fsEntries.Add(ArchiveReconstructionUtils.GetFsEntry(ncaReader, fsIndex, replaceRule1)); } else { commonNcaInfo.fsEntries.Add(ArchiveReconstructionUtils.GetFsEntry(ncaReader, fsIndex)); } } return(commonNcaInfo); }
internal static NintendoContentFileSystemInfo GetProdNcaInfo(NintendoContentArchiveReader ncaReader) { NintendoContentFileSystemInfo commonNcaInfo = ArchiveReconstructionUtils.GetCommonNcaInfo(ncaReader); commonNcaInfo.keyAreaEncryptionKeyIndex = (byte)0; commonNcaInfo.isProdEncryption = true; for (int fsIndex = 0; fsIndex < commonNcaInfo.numFsEntries; ++fsIndex) { commonNcaInfo.fsEntries.Add(ArchiveReconstructionUtils.GetFsEntry(ncaReader, fsIndex)); } return(commonNcaInfo); }