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

@ -9,6 +9,7 @@ using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Common.Utilities;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using static Ryujinx.Common.Utilities.XCIFileTrimmer;
@ -54,10 +55,10 @@ namespace Ryujinx.Ava.UI.ViewModels
private void LoadXCIApplications()
{
var apps = ApplicationLibrary.Applications.Items
IEnumerable<ApplicationData> apps = ApplicationLibrary.Applications.Items
.Where(app => app.FileExtension == _FileExtXCI);
foreach (var xciApp in apps)
foreach (ApplicationData xciApp in apps)
AddOrUpdateXCITrimmerFile(CreateXCITrimmerFile(xciApp.Path));
ApplicationsChanged();
@ -67,7 +68,7 @@ namespace Ryujinx.Ava.UI.ViewModels
string path,
OperationOutcome operationOutcome = OperationOutcome.Undetermined)
{
var xciApp = ApplicationLibrary.Applications.Items.First(app => app.FileExtension == _FileExtXCI && app.Path == path);
ApplicationData xciApp = ApplicationLibrary.Applications.Items.First(app => app.FileExtension == _FileExtXCI && app.Path == path);
return XCITrimmerFileModel.FromApplicationData(xciApp, _logger) with { ProcessingOutcome = operationOutcome };
}
@ -156,17 +157,17 @@ namespace Ryujinx.Ava.UI.ViewModels
_processingMode = processingMode;
Processing = true;
var cancellationToken = _cancellationTokenSource.Token;
CancellationToken cancellationToken = _cancellationTokenSource.Token;
Thread XCIFileTrimThread = new(() =>
{
var toProcess = Sort(SelectedXCIFiles
List<XCITrimmerFileModel> toProcess = Sort(SelectedXCIFiles
.Where(xci =>
(processingMode == ProcessingMode.Untrimming && xci.Untrimmable) ||
(processingMode == ProcessingMode.Trimming && xci.Trimmable)
)).ToList();
var viewsSaved = DisplayedXCIFiles.ToList();
List<XCITrimmerFileModel> viewsSaved = DisplayedXCIFiles.ToList();
Dispatcher.UIThread.Post(() =>
{
@ -177,19 +178,19 @@ namespace Ryujinx.Ava.UI.ViewModels
try
{
foreach (var xciApp in toProcess)
foreach (XCITrimmerFileModel xciApp in toProcess)
{
if (cancellationToken.IsCancellationRequested)
break;
var trimmer = new XCIFileTrimmer(xciApp.Path, _logger);
XCIFileTrimmer trimmer = new XCIFileTrimmer(xciApp.Path, _logger);
Dispatcher.UIThread.Post(() =>
{
ProcessingApplication = xciApp;
});
var outcome = OperationOutcome.Undetermined;
OperationOutcome outcome = OperationOutcome.Undetermined;
try
{
@ -347,7 +348,7 @@ namespace Ryujinx.Ava.UI.ViewModels
Sort(AllXCIFiles)
.AsObservableChangeSet()
.Filter(Filter)
.Bind(out var view).AsObservableList();
.Bind(out ReadOnlyObservableCollection<XCITrimmerFileModel> view).AsObservableList();
_displayedXCIFiles.Clear();
_displayedXCIFiles.AddRange(view);