예제 #1
0
        public IReadOnlyList <ArchiveFileInfo> Load(Stream input)
        {
            using var br = new BinaryReaderX(input, true);

            // Read header
            var header = br.ReadType <PackHeader>();

            // Read file entries
            var entries = br.ReadMultiple <PackFileEntry>(header.fileCount + 1);

            // Add files
            var result = new List <ArchiveFileInfo>();

            for (var i = 0; i < header.fileCount; i++)
            {
                var fileStream = new SubStream(input, entries[i].offset, entries[i + 1].offset - entries[i].offset);
                var extension  = DetermineExtension(entries[i].fileType);

                result.Add(new ArchiveFileInfo(fileStream, i.ToString("00000000") + extension)
                {
                    PluginIds = PackSupport.RetrievePluginMapping(entries[i].fileType)
                });
            }

            return(result);
        }
예제 #2
0
        public IList <IArchiveFileInfo> Load(Stream input)
        {
            using var br = new BinaryReaderX(input, true);

            // Read header
            var header = br.ReadType <PackHeader>();

            // Read entries
            var entries = br.ReadMultiple <PackFileEntry>(header.fileCount + 1);

            // Add files
            var result = new List <IArchiveFileInfo>();

            for (var i = 0; i < header.fileCount; i++)
            {
                var entry = entries[i];

                var subStream = new SubStream(input, entry.offset, entries[i + 1].offset - entry.offset);
                var name      = $"{i:00000000}{PackSupport.DetermineExtension(entry.fileType)}";

                result.Add(new PackArchiveFileInfo(subStream, name, entry)
                {
                    PluginIds = PackSupport.RetrievePluginMapping(entries[i].fileType)
                });
            }

            return(result);
        }