Skip to content

Commit

Permalink
use async in file stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Folleach committed Jun 3, 2023
1 parent 4d7f453 commit 82931b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GeometryDashAPI/Data/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public virtual async Task LoadAsync(string fileName)
#if NETSTANDARD2_1
var data = await File.ReadAllBytesAsync(fileName);
#else
using var file = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
using var file = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, useAsync: true);
var data = new byte[file.Length];
var read = await file.ReadAsync(data, 0, data.Length);
#endif
Expand Down Expand Up @@ -70,7 +70,7 @@ public async Task SaveAsync(string? fileName = null)
#if NETSTANDARD2_1
await File.WriteAllBytesAsync(fileName ?? ResolveFileName(type), GetFileContent(memory));
#else
using var file = new FileStream(fileName ?? ResolveFileName(type), FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
using var file = new FileStream(fileName ?? ResolveFileName(type), FileMode.Create, FileAccess.ReadWrite, FileShare.Read, 4096, useAsync: true);
var data = GetFileContent(memory);
await file.WriteAsync(data, 0, data.Length);
#endif
Expand Down

0 comments on commit 82931b3

Please sign in to comment.