Compare commits
2 Commits
Canary-1.2
...
Canary-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6482e566ab | ||
|
|
7fcd9b792e |
@@ -28,7 +28,9 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
|
|
||||||
public class CompatibilityCsv
|
public class CompatibilityCsv
|
||||||
{
|
{
|
||||||
static CompatibilityCsv()
|
static CompatibilityCsv() => Load();
|
||||||
|
|
||||||
|
public static void Load()
|
||||||
{
|
{
|
||||||
using Stream csvStream = Assembly.GetExecutingAssembly()
|
using Stream csvStream = Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
||||||
@@ -37,15 +39,31 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
using SepReader reader = Sep.Reader().From(csvStream);
|
using SepReader reader = Sep.Reader().From(csvStream);
|
||||||
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
||||||
|
|
||||||
Entries = reader
|
_entries = reader
|
||||||
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
||||||
.OrderBy(it => it.GameName)
|
.OrderBy(it => it.GameName)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.", "LoadCompatCsv");
|
Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.", "LoadCompatibility");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompatibilityEntry[] Entries { get; private set; }
|
public static void Unload()
|
||||||
|
{
|
||||||
|
_entries = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CompatibilityEntry[] _entries;
|
||||||
|
|
||||||
|
public static CompatibilityEntry[] Entries
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_entries == null)
|
||||||
|
Load();
|
||||||
|
|
||||||
|
return _entries;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompatibilityEntry
|
public class CompatibilityEntry
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using nietras.SeparatedValues;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.Compat
|
namespace Ryujinx.Ava.Utilities.Compat
|
||||||
@@ -35,6 +32,8 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
contentDialog.Styles.Add(closeButtonParent);
|
contentDialog.Styles.Add(closeButtonParent);
|
||||||
|
|
||||||
await ContentDialogHelper.ShowAsync(contentDialog);
|
await ContentDialogHelper.ShowAsync(contentDialog);
|
||||||
|
|
||||||
|
CompatibilityCsv.Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompatibilityList()
|
public CompatibilityList()
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using ExCSS;
|
|
||||||
using Gommon;
|
using Gommon;
|
||||||
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.Compat
|
namespace Ryujinx.Ava.Utilities.Compat
|
||||||
{
|
{
|
||||||
public partial class CompatibilityViewModel : ObservableObject
|
public class CompatibilityViewModel : BaseModel
|
||||||
{
|
{
|
||||||
[ObservableProperty] private bool _onlyShowOwnedGames = true;
|
private bool _onlyShowOwnedGames = true;
|
||||||
|
|
||||||
private IEnumerable<CompatibilityEntry> _currentEntries = CompatibilityCsv.Entries;
|
private IEnumerable<CompatibilityEntry> _currentEntries = CompatibilityCsv.Entries;
|
||||||
private readonly string[] _ownedGameTitleIds = [];
|
private string[] _ownedGameTitleIds = [];
|
||||||
private readonly ApplicationLibrary _appLibrary;
|
|
||||||
|
|
||||||
public IEnumerable<CompatibilityEntry> CurrentEntries => OnlyShowOwnedGames
|
public IEnumerable<CompatibilityEntry> CurrentEntries => OnlyShowOwnedGames
|
||||||
? _currentEntries.Where(x =>
|
? _currentEntries.Where(x =>
|
||||||
@@ -24,14 +23,23 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
|
|
||||||
public CompatibilityViewModel(ApplicationLibrary appLibrary)
|
public CompatibilityViewModel(ApplicationLibrary appLibrary)
|
||||||
{
|
{
|
||||||
_appLibrary = appLibrary;
|
appLibrary.ApplicationCountUpdated += (_, _)
|
||||||
_ownedGameTitleIds = appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray();
|
=> _ownedGameTitleIds = appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray();
|
||||||
|
|
||||||
PropertyChanged += (_, args) =>
|
_ownedGameTitleIds = appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnlyShowOwnedGames
|
||||||
|
{
|
||||||
|
get => _onlyShowOwnedGames;
|
||||||
|
set
|
||||||
{
|
{
|
||||||
if (args.PropertyName is nameof(OnlyShowOwnedGames))
|
OnPropertyChanging();
|
||||||
OnPropertyChanged(nameof(CurrentEntries));
|
OnPropertyChanging(nameof(CurrentEntries));
|
||||||
};
|
_onlyShowOwnedGames = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(CurrentEntries));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Search(string searchTerm)
|
public void Search(string searchTerm)
|
||||||
|
|||||||
Reference in New Issue
Block a user