コード例 #1
0
        private CdIndexEntry ReadEntry(DataReader reader)
        {
            long         entryOffset = reader.Stream.Position;
            CdIndexEntry entry       = new CdIndexEntry();

            entry.IsFolder   = (reader.ReadUInt16() == 1);
            entry.SubEntries = reader.ReadUInt16();
            entry.IsLastFile = (entry.SubEntries == 0);
            long nameOffset = entryOffset + reader.ReadUInt32();

            entry.Offset = reader.ReadUInt32() * Padding;
            entry.Size   = reader.ReadUInt32();

            reader.Stream.Seek(nameOffset, SeekMode.Origin);
            entry.Name = reader.ReadString();
            reader.Stream.Seek(entryOffset + CdIndexEntry.EntrySize, SeekMode.Origin);

            return(entry);
        }
コード例 #2
0
        private void GiveFormat(Queue <CdIndexEntry> entries, FileContainer folder)
        {
            CdIndexEntry entry = entries.Dequeue();

            if (!entry.IsFolder)
            {
                folder.AddFile(new GameFile(
                                   entry.Name,
                                   new DataStream(this.File.Stream, entry.Offset, entry.Size)
                                   ));
                return;
            }

            // Create the folder
            GameFolder currFolder = new GameFolder(entry.Name, folder);

            // Add files and folders
            for (int i = 0; i < entry.SubEntries - 1; i++)
            {
                GiveFormat(entries, currFolder);
            }
        }