Example #1
0
        public Nintendo3dsCtrFile(FileStream isoStream, string parentDirectoryName, string sourceFilePath,
                                  string fileName, long offset, long size, Nintendo3dsCtr.FileSystemType fileSystem,
                                  IvfcLevelInfo level3HashInfo, long fileEntryOffset = 0, long fileBlockOffset = -1, long romFsDataOffset = -1)
        {
            this.ParentDirectoryName = parentDirectoryName;
            this.SourceFilePath      = sourceFilePath;
            this.FileDateTime        = new DateTime();

            this.IsRaw            = false;
            this.NonRawSectorSize = 0;
            this.FileMode         = CdSectorType.Unknown;

            this.Level3HashInfo = level3HashInfo;

            this.FileSystem = fileSystem;

            if (this.FileSystem == Nintendo3dsCtr.FileSystemType.RomFS)
            {
                this.BuildRomFsFile(isoStream, offset, fileEntryOffset, fileBlockOffset, romFsDataOffset);
            }
            else
            {
                this.FileName = fileName;
                this.Offset   = offset;
                this.Size     = size;
            }

            this.Lba = this.Offset;
        }
Example #2
0
        public Nintendo3dsCtrDirectory(FileStream isoStream, string sourceFilePath, string parentDirectoryName,
                                       long offset, Nintendo3dsCtr.FileSystemType fileSystem, IvfcLevelInfo[] ivfcLevels,
                                       long directoryEntryOffset = 0, long directoryBlockOffset = -1, long fileBlockOffset = -1,
                                       uint romFsDataOffset      = 0)
        {
            string nextDirectoryName;

            this.SourceFilePath      = sourceFilePath;
            this.SubDirectoryArray   = new ArrayList();
            this.FileArray           = new ArrayList();
            this.ParentDirectoryName = parentDirectoryName;

            this.FileSystem       = fileSystem;
            this.SiblingDirectory = null;

            this.IvfcLevels = ivfcLevels;

            if (this.FileSystem == Nintendo3dsCtr.FileSystemType.ExeFS)
            {
                this.DirectoryName = "ExeFS"; // @TODO: Make a constant
                nextDirectoryName  = this.ParentDirectoryName + Path.DirectorySeparatorChar + this.DirectoryName;
                this.InitializeExeFileSystem(isoStream, offset, nextDirectoryName);
            }
            else if (this.FileSystem == Nintendo3dsCtr.FileSystemType.RomFS)
            {
                this.DirectoryBlockOffset = directoryBlockOffset;
                this.FileBlockOffset      = fileBlockOffset;

                if (directoryEntryOffset == 0)
                {
                    this.InitializeRomFileSystem(isoStream, offset);
                }
                else
                {
                    this.RomFsDataOffset = romFsDataOffset;
                }

                this.BuildDirectory(isoStream, offset, directoryEntryOffset, this.DirectoryBlockOffset, this.FileBlockOffset);
            }
        }