Esempio n. 1
0
 public void GetNewFile(XFSInputFile xfs)
 {
     this.startOffset  = xfs.StartSector * 0x800L;
     this.startOffset += this._fsOffset;
     this.length       = xfs.GetFileLength();
     this.position     = 0L;
 }
Esempio n. 2
0
        private void ReadFileSystem()
        {
            XFSInputFile ifile = new XFSInputFile(this, this.RootSectorBlockSize * 0x800, this.RootSectorBlock);

            this.RootDir    = new XDvdFsFileSystemEntry(ifile);
            this.CurrentDir = this.RootDir;
            ISOFileStreamer ifs = new ISOFileStreamer(this.fileSystemOffset, new BinaryReader(this.GetStream()));

            ifs.GetNewFile(ifile);
            byte[] buffer = new byte[this.RootSectorBlockSize * 0x800];
            ifs.Read(buffer, 0, this.RootSectorBlockSize * 0x800);
            this.ReadFileSystemData(buffer, 0, this.RootDir, ifs);
            List <XDvdFsFileSystemEntry> fileList = this.RootDir.GetFileList();

            fileList.Sort(new FSOutSectorComparer());
            XDvdFsFileSystemEntry fse = new XDvdFsFileSystemEntry(new FSFolder("Temp"));

            foreach (XDvdFsFileSystemEntry entry2 in fileList)
            {
                if (((fse.StartSector == entry2.StartSector) && (fse.LogicalFileSize == entry2.LogicalFileSize)) && !entry2.IsFolder)
                {
                    entry2.SetLinkedTo(fse);
                }
                fse = entry2;
            }
        }
Esempio n. 3
0
 public ISOFileStreamer(XFSInputFile xfs, long FileSystemOffset, BinaryReader instream)
 {
     this.startOffset  = xfs.StartSector * 0x800L;
     this._fsOffset    = FileSystemOffset;
     this.startOffset += this._fsOffset;
     this.length       = xfs.GetFileLength();
     this.instream     = instream;
 }
Esempio n. 4
0
        private void ReadFileSystemData(byte[] buffer, int fsOffset, XDvdFsFileSystemEntry parentEntry, ISOFileStreamer ifs)
        {
            if (fsOffset > buffer.Length)
            {
                throw new SystemException("Disaster");
            }
            XFSInputFile          ifile = new XFSInputFile(this, buffer, fsOffset);
            XDvdFsFileSystemEntry entry = new XDvdFsFileSystemEntry(ifile);

            entry.ParentNode = parentEntry;
            ushort num  = BitConverter.ToUInt16(buffer, fsOffset);
            ushort num2 = BitConverter.ToUInt16(buffer, fsOffset + 2);

            if (ifile.StartSector == -1)
            {
                throw new SystemException("Invalid TOC entry");
            }
            if (num != 0)
            {
                if ((num * 4) > buffer.Length)
                {
                    throw new SystemException("Disaster 2!");
                }
                this.ReadFileSystemData(buffer, num * 4, parentEntry, ifs);
            }
            if (ifile.IsFolder())
            {
                if ((ifile.StartSector == 0) || (ifile.GetFileLength() == 0L))
                {
                    parentEntry.Files.Add(entry);
                }
                else
                {
                    byte[] buffer2 = new byte[ifile.GetFileLength()];
                    ifs.GetNewFile(ifile);
                    ifs.Read(buffer2, 0, (int)ifile.GetFileLength());
                    parentEntry.Files.Add(entry);
                    this.ReadFileSystemData(buffer2, 0, entry, ifs);
                }
            }
            else
            {
                parentEntry.Files.Add(entry);
            }
            if (num2 != 0)
            {
                if ((num2 * 4) > buffer.Length)
                {
                    throw new SystemException("Disaster 3!");
                }
                this.ReadFileSystemData(buffer, num2 * 4, parentEntry, ifs);
            }
        }
Esempio n. 5
0
 public XDvdFsFileSystemEntry(XFSInputFile ifile)
 {
     this.StartSector = ifile.StartSector;
     this.setinfile(ifile);
 }