Skip to content

Commit

Permalink
Implement ReadAsync in ZipAESStream, extra simple version
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy committed Feb 14, 2021
1 parent 78bc308 commit b3ce045
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ICSharpCode.SharpZipLib/Encryption/ZipAESStream.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.Core;

namespace ICSharpCode.SharpZipLib.Encryption
Expand Down Expand Up @@ -90,6 +92,13 @@ public override int Read(byte[] buffer, int offset, int count)
return nBytes;
}

/// <inheritdoc/>
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var readCount = Read(buffer, offset, count);
return Task.FromResult(readCount);
}

// Read data from the underlying stream and decrypt it
private int ReadAndTransform(byte[] buffer, int offset, int count)
{
Expand Down

0 comments on commit b3ce045

Please sign in to comment.