sonicretro / KENSSharp

KENSSharp: Compression and decompression library
http://segaretro.org/KENSSharp
GNU Lesser General Public License v3.0
13 stars 6 forks source link

Reduce duplicate code in the LZSS compressors #4

Closed Clownacy closed 5 years ago

Clownacy commented 5 years ago

So I finally got around to adding the fancy graph-based compression logic flamewing described here, based on the implementation in my own library. However, my C# sucks so there's a lot of duplicate code.

I tried splitting the match-finding core into its own class, and making each compressor inherit it, but for some reason C# doesn't let static classes inherit. In my own library, I abused the C preprocessor to do this.

It would help readability and not to mention maintainability if this were sorted out.

Clownacy commented 5 years ago

Oh whoops, forgot this issue was here. FIgured out a way in 454b9fb9b88025b5431fe360a759598530d7a3e5, finished it in b2596b1436562145cf98130e3d5a66b556ca7531. Too bad I couldn't get it all done with callbacks like I could in C but eh, this is close enough.

I suppose the next bit of fat to trim is all those pointless bitstream classes, but that's an issue for another time.