We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adler32 checksum no work
In Formatter.cs use Adler32 as checksum
static byte[] PackCompressedBlock(byte[] data, DataType dataType) { var adler = BitConverter.GetBytes(Adler32.Compute(data)); using (var compressedStream = new MemoryStream()) { compressedStream.WriteByte(0x58); compressedStream.WriteByte(0x85); using (var outputStream = new DeflateStream(compressedStream, CompressionMode.Compress, true)) { outputStream.Write(BitConverter.GetBytes((int)dataType), 0, 4); outputStream.Write(BitConverter.GetBytes(data.Length), 0, 4); outputStream.Write(data, 0, data.Length); outputStream.Flush(); } compressedStream.WriteByte(adler[3]); compressedStream.WriteByte(adler[2]); compressedStream.WriteByte(adler[1]); compressedStream.WriteByte(adler[0]); return compressedStream.ToArray(); } }
But in Parse.cs, just jump the Adler32 checksum, extrac the compressed bytes
static byte[] UnpackCompressedBlock(byte[] compressed, out DataType type) { byte[] data; using (var decompressed = new MemoryStream()) { using (var compressedStream = new MemoryStream(compressed, 2, compressed.Length - 6)) using (var decompressor = new DeflateStream(compressedStream, CompressionMode.Decompress)) { decompressor.CopyTo(decompressed); } decompressed.Position = 0; var buf = new byte[4]; decompressed.Read(buf, 0, 4); type = (DataType)BitConverter.ToInt32(buf, 0); decompressed.Read(buf, 0, 4); var size = BitConverter.ToInt32(buf, 0); data = new byte[size]; decompressed.Read(data, 0, size); } return data; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Adler32 checksum no work
In Formatter.cs use Adler32 as checksum
But in Parse.cs, just jump the Adler32 checksum, extrac the compressed bytes
The text was updated successfully, but these errors were encountered: