C# Custom File Parser

Job ID: 39810229

Budget: $10 – $30 USD

I've currently built a tool (using C#) which parses a few files, it's a custom file format.
It reads great, but now I need help replacing sub-archive files.

I will provide more info in the chat.

IMPORTANT! I Will NOT Release Any Payments Unless It WORKS!

Here's the layout.

main_file_cache.idx0..4
main_file_cache.dat

Note: The Only "Archive" That Contains SubArchives is The Archive Found In Idx0.
- Archive
- SubArchive (empty)
- SubArchive (title)
- SubArchive (config)

idx0..4 Points to data in the form of IndexEntries.
IndexEntry: 6 Bytes
- FileSize: 3 Bytes
- StartBlock: 3 Bytes

The main_file_cache.dat is laid out in "blocks" each consisting of 520 bytes.

BlockHeader: 8 Bytes
- NextFileId: 2 Bytes
- CurrentFilePartId: 2 Bytes
- NextDataBlockId: 3 Bytes
- NextFileTypeId: 1 Byte

DataBlock: 520 Bytes
- BlockHeader: 8 Bytes
- Data: 512 Bytes (padded with 0's, meaning it doesn't need to fill all 512 bytes)

SubArchive Buffer Structure:
NOTE: If Decompressed and Compressed size are not the same, we need to decompress the rest of the buffer before proceeding.
- SubArchiveHeader: 6 Bytes
- DecompressedSize: 3 Bytes
- CompressedSize: 3 Bytes
- Remaining Bytes: DecompressedSize || CompressedSize

There are are 5 archives in total:
- archive (containts subarchives which contains headless bzip2 files)
- model (contains a bunch of gzip files)
- anim (contains a bunch of gzip files)
- music (contains a bunch of gzip files)
- map (contains a bunch of gzip files)