When a parser succeeds, the scanner relies on the current position of the reader stream to use as the start of the next offset. A lot of times, a file may read sections and then skip back to the beginning of the file, and even end scanning there. because of this, more processing time is wasted scanning areas that were already confirmed to be a part of another file.
The idea for a solution is to either make a Stream or BinaryReader wrapper that tracks the highest position the stream is at (mainly by logging the position during Seek). This way, the highest offset can be used.
There are some issues to consider with this though, and it may even be better to make this an option, rather than forced on. For example, if scanning a large file and you get a very high pointer offset that points to garbage data, you'll end up excluding a ton of the file if the parser has a false positive and succeeds.
When a parser succeeds, the scanner relies on the current position of the reader stream to use as the start of the next offset. A lot of times, a file may read sections and then skip back to the beginning of the file, and even end scanning there. because of this, more processing time is wasted scanning areas that were already confirmed to be a part of another file.
The idea for a solution is to either make a Stream or BinaryReader wrapper that tracks the highest position the stream is at (mainly by logging the position during Seek). This way, the highest offset can be used.
There are some issues to consider with this though, and it may even be better to make this an option, rather than forced on. For example, if scanning a large file and you get a very high pointer offset that points to garbage data, you'll end up excluding a ton of the file if the parser has a false positive and succeeds.