SceneGate / Yarhl

Framework for the implementation of format converters like game assets or media files
https://scenegate.github.io/Yarhl/
MIT License
60 stars 10 forks source link

🐛 Comparing stream to itself returns false #199

Closed pleonex closed 9 months ago

pleonex commented 9 months ago

DataStream.Compare with the same object was returning that the stream was not identical. We were not detecting that it's the same instance and trying to read twice from the same object.

This PR closes #189

Quality check list

Acceptance criteria

Follow-up work

None

Example

using var stream1 = new DataStream();
stream1.WriteByte(0xCA);
DataStream stream2 = stream1;
Assert.IsTrue(stream1.Compare(stream2))