Exemple #1
0
        public IList <IArchiveFileInfo> Load(Stream input)
        {
            using var br = new BinaryReaderX(input, true);

            // Read header
            _header   = br.ReadType <TarcHeader>();
            _hasNames = _header.nameOffset != 0;

            // Read entries
            input.Position = _header.entryOffset;
            var entries = br.ReadMultiple <TarcEntry>(_header.fileCount);

            // 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.fileOffset, entry.compSize);

                var fileName = $"{i:00000000}.bin";
                if (_hasNames)
                {
                    input.Position = entry.nameOffset;
                    fileName       = br.ReadCStringASCII();
                }

                result.Add(CreateAfi(subStream, fileName, entry));
            }

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

            // Read header
            _header = br.ReadType <TarcHeader>();

            // Read entries
            input.Position = _header.entryOffset;
            var entries = br.ReadMultiple <TarcEntry>(_header.fileCount);

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

            foreach (var entry in entries)
            {
                var subStream = new SubStream(input, entry.fileOffset, entry.compSize);

                input.Position = entry.nameOffset;
                var fileName = br.ReadCStringASCII();

                result.Add(CreateAfi(subStream, fileName, entry));
            }

            return(result);
        }