misc: chore: Use explicit types in the Avalonia project

This commit is contained in:
Evan Husted 2025-01-25 14:00:23 -06:00
parent 3b5f6170d1
commit be3bd0bcb5
69 changed files with 367 additions and 348 deletions

View file

@ -215,7 +215,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
return;
}
var selected = Devices[_device].Type;
DeviceType selected = Devices[_device].Type;
if (selected != DeviceType.None)
{
@ -299,7 +299,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
}
else
{
var type = DeviceType.None;
DeviceType type = DeviceType.None;
if (Config is StandardKeyboardInputConfig)
{
@ -311,7 +311,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
type = DeviceType.Controller;
}
var item = Devices.FirstOrDefault(x => x.Type == type && x.Id == Config.Id);
(DeviceType Type, string Id, string Name) item = Devices.FirstOrDefault(x => x.Type == type && x.Id == Config.Id);
if (item != default)
{
Device = Devices.ToList().FindIndex(x => x.Id == item.Id);
@ -331,7 +331,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
}
string id = GetCurrentGamepadId();
var type = Devices[Device].Type;
DeviceType type = Devices[Device].Type;
if (type == DeviceType.None)
{
@ -373,7 +373,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
return string.Empty;
}
var device = Devices[Device];
(DeviceType Type, string Id, string Name) device = Devices[Device];
if (device.Type == DeviceType.None)
{
@ -485,7 +485,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private string GetProfileBasePath()
{
string path = AppDataManager.ProfilesDirPath;
var type = Devices[Device == -1 ? 0 : Device].Type;
DeviceType type = Devices[Device == -1 ? 0 : Device].Type;
if (type == DeviceType.Keyboard)
{
@ -525,7 +525,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public InputConfig LoadDefaultConfiguration()
{
var activeDevice = Devices.FirstOrDefault();
(DeviceType Type, string Id, string Name) activeDevice = Devices.FirstOrDefault();
if (Devices.Count > 0 && Device < Devices.Count && Device >= 0)
{
@ -822,20 +822,20 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
}
else
{
var device = Devices[Device];
(DeviceType Type, string Id, string Name) device = Devices[Device];
if (device.Type == DeviceType.Keyboard)
{
var inputConfig = (ConfigViewModel as KeyboardInputViewModel).Config;
KeyboardInputConfig inputConfig = (ConfigViewModel as KeyboardInputViewModel).Config;
inputConfig.Id = device.Id;
}
else
{
var inputConfig = (ConfigViewModel as ControllerInputViewModel).Config;
GamepadInputConfig inputConfig = (ConfigViewModel as ControllerInputViewModel).Config;
inputConfig.Id = device.Id.Split(" ")[0];
}
var config = !IsController
InputConfig config = !IsController
? (ConfigViewModel as KeyboardInputViewModel).Config.GetConfig()
: (ConfigViewModel as ControllerInputViewModel).Config.GetConfig();
config.ControllerType = Controllers[_controller].Type;