private static NintendoContentFileSystemInfo.EntryInfo GetFsEntry(NintendoContentArchiveReader ncaReader, int fsIndex, EntryReplaceRule replaceRule) { NintendoContentArchiveFsHeaderInfo fsInfo = (NintendoContentArchiveFsHeaderInfo)null; IFileSystemArchiveReader systemArchiveReader = ncaReader.OpenFileSystemArchiveReader(fsIndex, ref fsInfo); NintendoContentFileSystemInfo.EntryInfo commonFsEntry = ArchiveReconstructionUtils.GetCommonFsEntry(fsInfo, fsIndex); Tuple <long, long> tuple = systemArchiveReader.GetFileFragmentList(replaceRule.Path).First <Tuple <long, long> >(); long offset = tuple.Item1; if (tuple.Item2 == replaceRule.Source.Size) { AdaptedSource adaptedSource = new AdaptedSource((ISource) new FileSystemArchvieBaseSource(systemArchiveReader), replaceRule.Source, offset, replaceRule.Source.Size); commonFsEntry.sourceInterface = (SourceInterface) new CliCompatibleSource((ISource)adaptedSource); } else if (commonFsEntry.formatType == "RomFs") { RomFsArchiveSource romFsArchiveSource = new RomFsArchiveSource(ArchiveReconstructionUtils.GetRomFsInfo(systemArchiveReader, replaceRule)); commonFsEntry.sourceInterface = (SourceInterface) new CliCompatibleSource((ISource)romFsArchiveSource); } else if (commonFsEntry.formatType == "PartitionFs") { PartitionFsArchiveSource partitionFsArchiveSource = new PartitionFsArchiveSource(ArchiveReconstructionUtils.GetPartitionFsInfo(systemArchiveReader, replaceRule)); commonFsEntry.sourceInterface = (SourceInterface) new CliCompatibleSource((ISource)partitionFsArchiveSource); } return(commonFsEntry); }
private static NintendoContentFileSystemInfo.EntryInfo GetFsEntry(NintendoContentArchiveReader ncaReader, int fsIndex) { NintendoContentArchiveFsHeaderInfo fsInfo = (NintendoContentArchiveFsHeaderInfo)null; IFileSystemArchiveReader reader = ncaReader.OpenFileSystemArchiveReader(fsIndex, ref fsInfo); NintendoContentFileSystemInfo.EntryInfo commonFsEntry = ArchiveReconstructionUtils.GetCommonFsEntry(fsInfo, fsIndex); FileSystemArchvieBaseSource archvieBaseSource = new FileSystemArchvieBaseSource(reader); commonFsEntry.sourceInterface = (SourceInterface) new CliCompatibleSource((ISource)archvieBaseSource); return(commonFsEntry); }
private static NintendoContentFileSystemInfo.EntryInfo GetCommonFsEntry(NintendoContentArchiveFsHeaderInfo fsHeaderInfo, int fsIndex) { return(new NintendoContentFileSystemInfo.EntryInfo() { type = "source", formatType = fsHeaderInfo.GetFormatType(), version = fsHeaderInfo.GetVersion(), hashType = fsHeaderInfo.GetHashType(), encryptionType = fsHeaderInfo.GetEncryptionType(), partitionIndex = fsIndex, sourceInterface = (SourceInterface)null }); }