Skip to content

Commit

Permalink
Patched for PngByteQRCode .NET 3.5 backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
codebude committed Oct 8, 2017
1 parent 744138b commit 2b98d81
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions QRCoder/PngByteQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ public void WriteScanlines(byte[] scanlines)

// Compressed data.
idatStream.Position = 0;
#if NET35
idatStream.WriteTo(this.stream);
#else
idatStream.CopyTo(this.stream);

#endif
// Deflate checksum.
var adler = Adler32(scanlines, 0, scanlines.Length);
this.WriteIntBigEndian(adler);
Expand Down Expand Up @@ -275,7 +278,7 @@ private void WriteIntBigEndian(uint value)

private static void Deflate(Stream output, byte[] bytes)
{
using (var deflateStream = new DeflateStream(output, CompressionLevel.Optimal, leaveOpen: true))
using (var deflateStream = new DeflateStream(output, CompressionMode.Compress, leaveOpen: true))
{
deflateStream.Write(bytes, 0, bytes.Length);
}
Expand Down

0 comments on commit 2b98d81

Please sign in to comment.