misc: chore: Use explicit types & fix object creation

This commit is contained in:
KeatonTheBot
2026-05-30 16:26:50 -05:00
parent 9d3fecf334
commit 76a123b81d
454 changed files with 3042 additions and 2961 deletions
@@ -1056,9 +1056,9 @@ namespace Ryujinx.Ava.UI.ViewModels
private void PrepareLoadScreen()
{
using MemoryStream stream = new(SelectedIcon);
using var gameIconBmp = SKBitmap.Decode(stream);
using SKBitmap gameIconBmp = SKBitmap.Decode(stream);
var dominantColor = IconColorPicker.GetFilteredColor(gameIconBmp);
SKColor dominantColor = IconColorPicker.GetFilteredColor(gameIconBmp);
const float ColorMultiple = 0.5f;
@@ -1167,7 +1167,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
IReadOnlyList<IStorageFolder> result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
AllowMultiple = true,
@@ -1175,10 +1175,10 @@ namespace Ryujinx.Ava.UI.ViewModels
if (result.Count > 0)
{
var dirs = result.Select(it => it.Path.LocalPath).ToList();
var numAdded = onDirsSelected(dirs, out int numRemoved);
List<string> dirs = result.Select(it => it.Path.LocalPath).ToList();
int numAdded = onDirsSelected(dirs, out int numRemoved);
var msg = String.Join("\r\n", new[] {
string msg = String.Join("\r\n", new[] {
string.Format(LocaleManager.Instance[localeMessageRemovedKey], numRemoved),
string.Format(LocaleManager.Instance[localeMessageAddedKey], numAdded)
});
@@ -1215,17 +1215,17 @@ namespace Ryujinx.Ava.UI.ViewModels
public void LoadConfigurableHotKeys()
{
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUI, out var showUiKey))
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUI, out Avalonia.Input.Key showUiKey))
{
ShowUiKey = new KeyGesture(showUiKey);
}
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot, out var screenshotKey))
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot, out Avalonia.Input.Key screenshotKey))
{
ScreenshotKey = new KeyGesture(screenshotKey);
}
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Pause, out var pauseKey))
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Pause, out Avalonia.Input.Key pauseKey))
{
PauseKey = new KeyGesture(pauseKey);
}
@@ -1275,7 +1275,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
IReadOnlyList<IStorageFile> result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = false,
FileTypeFilter = new List<FilePickerFileType>
@@ -1316,7 +1316,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
IReadOnlyList<IStorageFolder> result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
AllowMultiple = false,
});
@@ -1336,7 +1336,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
IReadOnlyList<IStorageFile> result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = false,
FileTypeFilter = new List<FilePickerFileType>
@@ -1377,7 +1377,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
IReadOnlyList<IStorageFolder> result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
AllowMultiple = false,
});
@@ -1494,7 +1494,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
IReadOnlyList<IStorageFile> result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFileDialogTitle],
AllowMultiple = false,
@@ -1592,7 +1592,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
IReadOnlyList<IStorageFolder> result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
AllowMultiple = false,
@@ -1649,7 +1649,7 @@ namespace Ryujinx.Ava.UI.ViewModels
this,
TopLevel);
CancellationTokenSource cts = new CancellationTokenSource();
CancellationTokenSource cts = new();
try
{
@@ -1796,7 +1796,7 @@ namespace Ryujinx.Ava.UI.ViewModels
if (AppHost.Device.System.SearchingForAmiibo(out _) && IsGameRunning)
{
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
IReadOnlyList<IStorageFile> result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFileDialogTitle],
AllowMultiple = false,
@@ -2041,16 +2041,16 @@ namespace Ryujinx.Ava.UI.ViewModels
return;
}
var trimmer = new XCIFileTrimmer(filename, new XCIFileTrimmerMainWindowLog(this));
XCIFileTrimmer trimmer = new(filename, new XCIFileTrimmerMainWindowLog(this));
if (trimmer.CanBeTrimmed)
{
var savings = (double)trimmer.DiskSpaceSavingsB / 1024.0 / 1024.0;
var currentFileSize = (double)trimmer.FileSizeB / 1024.0 / 1024.0;
var cartDataSize = (double)trimmer.DataSizeB / 1024.0 / 1024.0;
double savings = (double)trimmer.DiskSpaceSavingsB / 1024.0 / 1024.0;
double currentFileSize = (double)trimmer.FileSizeB / 1024.0 / 1024.0;
double cartDataSize = (double)trimmer.DataSizeB / 1024.0 / 1024.0;
string secondaryText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.TrimXCIFileDialogSecondaryText, currentFileSize, cartDataSize, savings);
var result = await ContentDialogHelper.CreateConfirmationDialog(
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
LocaleManager.Instance[LocaleKeys.TrimXCIFileDialogPrimaryText],
secondaryText,
LocaleManager.Instance[LocaleKeys.Continue],