Skip to content

consider switching out zlib for SharpZipLib #87

@patrickhuber

Description

@patrickhuber

The dependency on zlib uses a c library which lacks a managed interface and regular updates that can be achieved with a nuget package of SharpZipLib.

I implemented a proof of concept decoding the hex codes of www.cityofheroesplanner.com in my data export library here:

Code under test here:

Its pretty simple to get it setup:

install SharpZipLib

install-package SharpZipLib

Create a stream around an existing byte stream (like the hex stream from the encoded build urls)

var encoded = Encoding.ASCII.GetBytes(data.EncodedString);
var decodedBytes = HexUtil.Decode(encoded);
var compressedStream = new MemoryStream(decodedBytes);
_internalStream = new InflaterInputStream(compressedStream);

Read from the internal stream like you would any other stream. For example, wrapping it in a BinaryReader. I happened to encapsulate it in a wrapper class so I could avoid the boiler plate code for setting it up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions