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);
        }
        private static void GetFsInfo(IFileSystemArchiveReader fsReader, EntryReplaceRule replaceRule, ArchiveReconstructionUtils.AddEntryToFsInfo addEntryDelegate)
        {
            ArchiveReconstructionUtils.BasicFileInfo basicFileInfo1 = new ArchiveReconstructionUtils.BasicFileInfo(fsReader.ListFileInfo().Find((Predicate <Tuple <string, long> >)(x => x.Item1 == replaceRule.Path)), fsReader);
            long num = replaceRule.Source.Size - basicFileInfo1.Size;
            List <ArchiveReconstructionUtils.BasicFileInfo> basicFileInfoList = new List <ArchiveReconstructionUtils.BasicFileInfo>();

            foreach (Tuple <string, long> fileInfo in fsReader.ListFileInfo())
            {
                ArchiveReconstructionUtils.BasicFileInfo basicFileInfo2 = new ArchiveReconstructionUtils.BasicFileInfo(fileInfo, fsReader);
                if (basicFileInfo2.Offset > basicFileInfo1.Offset)
                {
                    basicFileInfo2.Offset += num;
                }
                if (basicFileInfo2.Name == replaceRule.Path)
                {
                    basicFileInfo2.Size   = replaceRule.Source.Size;
                    basicFileInfo2.Source = (SourceInterface) new CliCompatibleSource(replaceRule.Source);
                }
                else
                {
                    basicFileInfo2.Source = (SourceInterface) new CliCompatibleSource((ISource) new FileSystemArchvieFileSource(fsReader, basicFileInfo2.Name));
                }
                basicFileInfoList.Add(basicFileInfo2);
            }
            addEntryDelegate((IEnumerable <ArchiveReconstructionUtils.BasicFileInfo>)basicFileInfoList);
        }