Question

I'm trying to read from a section of this file that had a payload stored to it when being dumped from the Xbox.

What I'm trying to do is read from where the payload is and if it equals to all 0's then change a label to saying No.

I knew I am probably supposed to use BinaryReader, but I don't have much experience with it. The payload starts at 0x32500 and ends at 0x3256F.

I need this in C#.

Was it helpful?

Solution

You can fast forward the stream when reading via the Seek method. Then use the BinaryReader's ReadBytes method to read the bytes from that offset.

using (var br = new BinaryReader(stream)) {
    br.BaseStream.Seek(0x32500, SeekOrigin.Begin);
    var bytes = br.ReadBytes(0x3256F - 0x32500);

    if (bytes.All(x => x == 0)) {
        label.Text = "No";
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top