Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte[] fileBytes = [THIS IS YOUR ORIGINAL FILE...]
- List<byte> header = new List<byte>();
- int actualIndex = 0;
- int riffIndex = -1;
- while (actualIndex < fileBytes.Length && riffIndex == -1)
- {
- if(fileBytes[actualIndex] + fileBytes[actualIndex + 1] + fileBytes[actualIndex + 2] + fileBytes[actualIndex + 3] == "RIFF")
- {
- riffIndex = actualIndex;
- }
- else
- {
- actualIndex = actualIndex + 1;
- }
- }
- for(int x = 0; x < riffIndex; x++)
- {
- header.Add(fileBytes[x]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement