File open/write async flag enabled. 1MB buffer

This commit is contained in:
Justin Swanson 2020-08-11 07:13:33 -05:00
parent 04d69299ec
commit 2e3b25ee69
2 changed files with 2 additions and 9 deletions

View File

@ -397,14 +397,14 @@ namespace Wabbajack.Common
{
var path = _path;
return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(async () =>
File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize: 1048576, useAsync: true));
}
public ValueTask<FileStream> WriteShared()
{
var path = _path;
return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(async () =>
File.Open(path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite));
File.Open(path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite, bufferSize: 1048576, useAsync: true));
}
public async Task CopyDirectoryToAsync(AbsolutePath destination)

View File

@ -1098,13 +1098,6 @@ namespace Wabbajack.Common
return bytes;
}
public static async Task CopyFileAsync(string src, string dest)
{
await using var s = File.OpenRead(src);
await using var d = File.Create(dest);
await s.CopyToAsync(d);
}
public static string ToNormalString(this SecureString value)
{
var valuePtr = IntPtr.Zero;