private List <FstFile> recurseFolders(FstFolder folder, List <FstFile> files) { files.AddRange(folder.Files); foreach (FstFolder fl in folder.Folders) { recurseFolders(fl, files); } return(files); }
internal static FileSystem Parse(MemorySection ms, FstFile fst, string id, bool isGc) { FstFolder fld = new FstFolder(null); long nFiles = ms.ReadUInt32B(0x8); if (12 * nFiles > ms.Size) { return(null); } if (fst != null) { fld.Files.Add(fst); } recurseFst(ms, fld, 12 * nFiles, 0, id, isGc); return(new FileSystem(fld)); }
private static uint recurseFst(MemorySection ms, FstFolder folder, long names, uint i, string id, bool isGc) { uint j; uint hdr = ms.ReadUInt32B((int)(12 * i)); long name = names + hdr & 0x00ffffffL; int type = (int)(hdr >> 24); string nm = ms.ReadStringToNull((int)name, Encoding.GetEncoding("shift-jis")); uint size = ms.ReadUInt32B((int)(12 * i + 8)); if (type == 1) { FstFolder f = i == 0 ? folder : new FstFolder(folder) { Name = nm }; if (i != 0) { folder.Folders.Add(f); } for (j = i + 1; j < size;) { j = recurseFst(ms, f, names, j, id, isGc); } return(size); } else { int pos = (int)(12 * i + 4); long doff = ms.ReadUInt32B(pos) * (isGc ? 1L : 4L); //offset in data size = ms.ReadUInt32B((int)(12 * i + 8)); long off = NStream.DataToOffset(doff, !isGc); //offset in raw partition folder.Files.Add(new FstFile(folder) { DataOffset = doff, Offset = off, Length = size, Name = nm, PartitionId = id, OffsetInFstFile = pos }); return(i + 1); } }
internal FstFile(FstFolder parent) { this.Parent = parent; }
private FileSystem(FstFolder root) { this.Root = root; }
public FstFolder(FstFolder parent) { this.Folders = new List <FstFolder>(); this.Files = new List <FstFile>(); this.Parent = parent; }
public FstFolder(FstFolder parent) { Folders = new List <FstFolder>(); Files = new List <FstFile>(); Parent = parent; }
internal FstFile(FstFolder parent) { Parent = parent; }