Advertisement
Guest User

dmc5

a guest
May 26th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. byte[] fileBytes = [THIS IS YOUR ORIGINAL FILE...]
  2.  
  3. List<byte> header = new List<byte>();
  4. int actualIndex = 0;
  5. int riffIndex = -1;
  6.  
  7. while (actualIndex < fileBytes.Length && riffIndex == -1)
  8. {
  9. if(fileBytes[actualIndex] + fileBytes[actualIndex + 1] + fileBytes[actualIndex + 2] + fileBytes[actualIndex + 3] == "RIFF")
  10. {
  11. riffIndex = actualIndex;
  12. }
  13. else
  14. {
  15. actualIndex = actualIndex + 1;
  16. }
  17. }
  18.  
  19. for(int x = 0; x < riffIndex; x++)
  20. {
  21. header.Add(fileBytes[x]);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement