private static RomFsFileSystemInfo GetRomFsInfo(IFileSystemArchiveReader fsReader, EntryReplaceRule replaceRule) { RomFsFileSystemInfo fsInfo = new RomFsFileSystemInfo(); DirectoryList directories = new DirectoryList(); ArchiveReconstructionUtils.AddEntryToFsInfo addEntryDelegate = (ArchiveReconstructionUtils.AddEntryToFsInfo)(fileInfoList => { foreach (ArchiveReconstructionUtils.BasicFileInfo fileInfo in fileInfoList) { RomFsFileSystemInfo.EntryInfo entryInfo = new RomFsFileSystemInfo.EntryInfo(); entryInfo.type = "source"; entryInfo.name = "/" + fileInfo.Name; entryInfo.size = (ulong)fileInfo.Size; entryInfo.offset = (ulong)fileInfo.Offset; entryInfo.path = (string)null; entryInfo.sourceInterface = fileInfo.Source; fsInfo.entries.Add(entryInfo); ++fsInfo.fileEntryCount; directories.AddAncestors(Path.GetDirectoryName(entryInfo.name)); } }); ArchiveReconstructionUtils.GetFsInfo(fsReader, replaceRule, addEntryDelegate); fsInfo.directoryEntryCount = directories.Count; return(fsInfo); }
private static PartitionFileSystemInfo GetPartitionFsInfo(IFileSystemArchiveReader fsReader, EntryReplaceRule replaceRule) { PartitionFileSystemInfo fsInfo = new PartitionFileSystemInfo(); ArchiveReconstructionUtils.AddEntryToFsInfo addEntryDelegate = (ArchiveReconstructionUtils.AddEntryToFsInfo)(fileInfoList => { foreach (ArchiveReconstructionUtils.BasicFileInfo fileInfo in fileInfoList) { fsInfo.entries.Add(new PartitionFileSystemInfo.EntryInfo() { type = "source", name = fileInfo.Name, size = (ulong)fileInfo.Size, offset = (ulong)fileInfo.Offset, path = (string)null, sourceInterface = fileInfo.Source }); } }); ArchiveReconstructionUtils.GetFsInfo(fsReader, replaceRule, addEntryDelegate); return(fsInfo); }