Remove usage of `.Result` in `ArchiveReader`

This commit is contained in:
Dean Herbert 2021-12-30 23:08:05 +09:00
parent e38e1bb1d7
commit 670a30b64b
1 changed files with 12 additions and 1 deletions

View File

@ -32,7 +32,18 @@ protected ArchiveReader(string name)
public abstract IEnumerable<string> Filenames { get; }
public virtual byte[] Get(string name) => GetAsync(name).Result;
public virtual byte[] Get(string name)
{
using (Stream input = GetStream(name))
{
if (input == null)
return null;
byte[] buffer = new byte[input.Length];
input.Read(buffer);
return buffer;
}
}
public async Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = default)
{