mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add cancellation support to game-side IResourceStore
s
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.IO.Stores;
|
||||
|
||||
@ -33,7 +34,7 @@ namespace osu.Game.IO.Archives
|
||||
|
||||
public virtual byte[] Get(string name) => GetAsync(name).Result;
|
||||
|
||||
public async Task<byte[]> GetAsync(string name)
|
||||
public async Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using (Stream input = GetStream(name))
|
||||
{
|
||||
@ -41,7 +42,7 @@ namespace osu.Game.IO.Archives
|
||||
return null;
|
||||
|
||||
byte[] buffer = new byte[input.Length];
|
||||
await input.ReadAsync(buffer).ConfigureAwait(false);
|
||||
await input.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user