Add missing "await" prefix or "Async" suffix in "async" methods

This commit is contained in:
Marco Carvalho 2024-05-08 16:51:54 -03:00
commit 3d3f554439
7 changed files with 14 additions and 14 deletions

View file

@ -60,7 +60,7 @@ namespace Ryujinx.Common
public async static Task<byte[]> ReadAsync(Assembly assembly, string filename) public async static Task<byte[]> ReadAsync(Assembly assembly, string filename)
{ {
using var stream = GetStream(assembly, filename); await using var stream = GetStream(assembly, filename);
if (stream == null) if (stream == null)
{ {
return null; return null;
@ -97,7 +97,7 @@ namespace Ryujinx.Common
public async static Task<string> ReadAllTextAsync(Assembly assembly, string filename) public async static Task<string> ReadAllTextAsync(Assembly assembly, string filename)
{ {
using var stream = GetStream(assembly, filename); await using var stream = GetStream(assembly, filename);
if (stream == null) if (stream == null)
{ {
return null; return null;

View file

@ -59,7 +59,7 @@ namespace Ryujinx.Common.Utilities
public static async Task<byte[]> StreamToBytesAsync(Stream input, CancellationToken cancellationToken = default) public static async Task<byte[]> StreamToBytesAsync(Stream input, CancellationToken cancellationToken = default)
{ {
using MemoryStream stream = MemoryStreamManager.Shared.GetStream(); await using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
await input.CopyToAsync(stream, cancellationToken); await input.CopyToAsync(stream, cancellationToken);

View file

@ -387,9 +387,9 @@ namespace Ryujinx.Modules
if (OperatingSystem.IsLinux()) if (OperatingSystem.IsLinux())
{ {
using Stream inStream = File.OpenRead(updateFile); await using Stream inStream = File.OpenRead(updateFile);
using Stream gzipStream = new GZipInputStream(inStream); await using Stream gzipStream = new GZipInputStream(inStream);
using TarInputStream tarStream = new(gzipStream, Encoding.ASCII); await using TarInputStream tarStream = new(gzipStream, Encoding.ASCII);
updateDialog.ProgressBar.MaxValue = inStream.Length; updateDialog.ProgressBar.MaxValue = inStream.Length;
await Task.Run(() => await Task.Run(() =>
@ -429,7 +429,7 @@ namespace Ryujinx.Modules
} }
else else
{ {
using Stream inStream = File.OpenRead(updateFile); await using Stream inStream = File.OpenRead(updateFile);
using ZipFile zipFile = new(inStream); using ZipFile zipFile = new(inStream);
updateDialog.ProgressBar.MaxValue = zipFile.Count; updateDialog.ProgressBar.MaxValue = zipFile.Count;

View file

@ -250,8 +250,8 @@ namespace Ryujinx.UI.Windows
try try
{ {
using FileStream dlcJsonStream = File.Create(_amiiboJsonPath, 4096, FileOptions.WriteThrough); await using FileStream dlcJsonStream = File.Create(_amiiboJsonPath, 4096, FileOptions.WriteThrough);
dlcJsonStream.Write(Encoding.UTF8.GetBytes(amiiboJsonString)); await dlcJsonStream.WriteAsync(Encoding.UTF8.GetBytes(amiiboJsonString));
} }
catch (Exception exception) catch (Exception exception)
{ {

View file

@ -440,8 +440,8 @@ namespace Ryujinx.Ava.UI.ViewModels
try try
{ {
using FileStream dlcJsonStream = File.Create(_amiiboJsonPath, 4096, FileOptions.WriteThrough); await using FileStream dlcJsonStream = File.Create(_amiiboJsonPath, 4096, FileOptions.WriteThrough);
dlcJsonStream.Write(Encoding.UTF8.GetBytes(amiiboJsonString)); await dlcJsonStream.WriteAsync(Encoding.UTF8.GetBytes(amiiboJsonString));
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -479,7 +479,7 @@ namespace Ryujinx.Ava.UI.ViewModels
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
byte[] amiiboPreviewBytes = await response.Content.ReadAsByteArrayAsync(); byte[] amiiboPreviewBytes = await response.Content.ReadAsByteArrayAsync();
using MemoryStream memoryStream = new(amiiboPreviewBytes); await using MemoryStream memoryStream = new(amiiboPreviewBytes);
Bitmap bitmap = new(memoryStream); Bitmap bitmap = new(memoryStream);

View file

@ -230,7 +230,7 @@ namespace Ryujinx.Ava.UI.ViewModels
return; return;
} }
using FileStream containerFile = File.OpenRead(path); await using FileStream containerFile = File.OpenRead(path);
PartitionFileSystem partitionFileSystem = new(); PartitionFileSystem partitionFileSystem = new();
partitionFileSystem.Initialize(containerFile.AsStorage()).ThrowIfFailure(); partitionFileSystem.Initialize(containerFile.AsStorage()).ThrowIfFailure();

View file

@ -82,7 +82,7 @@ namespace Ryujinx.Ava.UI.Views.User
if (result.Count > 0) if (result.Count > 0)
{ {
_profile.Image = ProcessProfileImage(File.ReadAllBytes(result[0].Path.LocalPath)); _profile.Image = ProcessProfileImage(await File.ReadAllBytesAsync(result[0].Path.LocalPath));
_parent.GoBack(); _parent.GoBack();
} }
} }