示例#1
0
文件: FileSystem.cs 项目: skudi/NKit
        private List <FstFile> recurseFolders(FstFolder folder, List <FstFile> files)
        {
            files.AddRange(folder.Files);

            foreach (FstFolder fl in folder.Folders)
            {
                recurseFolders(fl, files);
            }
            return(files);
        }
示例#2
0
文件: FileSystem.cs 项目: skudi/NKit
        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));
        }
示例#3
0
        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);
            }
        }
示例#4
0
文件: FileSystem.cs 项目: skudi/NKit
 internal FstFile(FstFolder parent)
 {
     this.Parent = parent;
 }
示例#5
0
文件: FileSystem.cs 项目: skudi/NKit
 private FileSystem(FstFolder root)
 {
     this.Root = root;
 }
示例#6
0
文件: FileSystem.cs 项目: skudi/NKit
 public FstFolder(FstFolder parent)
 {
     this.Folders = new List <FstFolder>();
     this.Files   = new List <FstFile>();
     this.Parent  = parent;
 }
示例#7
0
 public FstFolder(FstFolder parent)
 {
     Folders = new List <FstFolder>();
     Files   = new List <FstFile>();
     Parent  = parent;
 }
示例#8
0
 internal FstFile(FstFolder parent)
 {
     Parent = parent;
 }