Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Extracting files from inside a file archive

Extracting files from inside a file archive

Scheduled Pinned Locked Moved C#
regextutorialquestionworkspace
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Luminare
    wrote on last edited by
    #1

    Hi, I was wondering if anyone could push me in the right direction on this one. I got a file with multiple files inside it like an archive, its not compressed it just seems like the files are stacked inside the file. I can read the headers of head indevidual file with a hex reader, so I have indetified that the file contain several wav files, some dds files and jpeg, avi etc. what I have visioned is a loop that goes trough the file and each time it identifies a header it dumps that header and the following data to a file and continues to read on sortof splitting the file up again. Im unsure if I should have a list of just the data headers im expecting to find or if I should make a struct with the structure setup of all the file spesification's im expecting and have the loop match against that. Also what would be the most efficient way to go trough the file, its pretty large (about 4-500mb)? structure example: typedef struct _avimainheader { _FourCC_ fcc; DWORD cb; DWORD dwMicroSecPerFrame; DWORD dwMaxBytesPerSec; DWORD dwPaddingGranularity; DWORD dwFlags; DWORD dwTotalFrames; DWORD dwInitialFrames; DWORD dwStreams; DWORD dwSuggestedBufferSize; DWORD dwWidth; DWORD dwHeight; DWORD dwReserved[4]; } AVIMAINHEADER;

    R 1 Reply Last reply
    0
    • L Luminare

      Hi, I was wondering if anyone could push me in the right direction on this one. I got a file with multiple files inside it like an archive, its not compressed it just seems like the files are stacked inside the file. I can read the headers of head indevidual file with a hex reader, so I have indetified that the file contain several wav files, some dds files and jpeg, avi etc. what I have visioned is a loop that goes trough the file and each time it identifies a header it dumps that header and the following data to a file and continues to read on sortof splitting the file up again. Im unsure if I should have a list of just the data headers im expecting to find or if I should make a struct with the structure setup of all the file spesification's im expecting and have the loop match against that. Also what would be the most efficient way to go trough the file, its pretty large (about 4-500mb)? structure example: typedef struct _avimainheader { _FourCC_ fcc; DWORD cb; DWORD dwMicroSecPerFrame; DWORD dwMaxBytesPerSec; DWORD dwPaddingGranularity; DWORD dwFlags; DWORD dwTotalFrames; DWORD dwInitialFrames; DWORD dwStreams; DWORD dwSuggestedBufferSize; DWORD dwWidth; DWORD dwHeight; DWORD dwReserved[4]; } AVIMAINHEADER;

      R Offline
      R Offline
      Roger CS
      wrote on last edited by
      #2

      Do you have any other files that accompany this file? I'm asking because a data file like you are describing would commonly have an index, either embedded in the data file or in a separate file. If you had the index you could position to the offsets and read. If you don't have an index you'll probably have to read sequentially and detect headers as you go. As far as efficiency is concerned... don't optimize unless the method you're using is too slow. In that case you want to find the bottlenecks and open them up.

      L 1 Reply Last reply
      0
      • R Roger CS

        Do you have any other files that accompany this file? I'm asking because a data file like you are describing would commonly have an index, either embedded in the data file or in a separate file. If you had the index you could position to the offsets and read. If you don't have an index you'll probably have to read sequentially and detect headers as you go. As far as efficiency is concerned... don't optimize unless the method you're using is too slow. In that case you want to find the bottlenecks and open them up.

        L Offline
        L Offline
        Luminare
        wrote on last edited by
        #3

        As far as I can tell its just that file, there are some compiled pyton files there that I have'nt had any luck prying information from, it might be that they hold a sort of a catalog but im unsure. I have been playing around trying to extract the raw data, but I have some problems getting the loop to determine where the data ends and where a new header begins.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups