1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-23 21:56:02 +00:00

Run formatter

This commit is contained in:
Jimmy Reichley 2024-08-16 23:28:30 -04:00
parent 7850a2b2aa
commit 47e2cc6f02
No known key found for this signature in database
GPG key ID: 67715DC5A329803C
7 changed files with 43 additions and 40 deletions

View file

@ -294,7 +294,7 @@ namespace Ryujinx.UI.App.Common
catch (FileNotFoundException)
{
Logger.Warning?.Print(LogClass.Application, $"The file was not found: '{applicationPath}'");
return false;
}
@ -492,7 +492,7 @@ namespace Ryujinx.UI.App.Common
return true;
}
public bool TryGetDownloadableContentFromFile(string filePath, out List<DownloadableContentModel> titleUpdates)
{
titleUpdates = [];
@ -511,9 +511,9 @@ namespace Ryujinx.UI.App.Common
IntegrityCheckLevel checkLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks
? IntegrityCheckLevel.ErrorOnInvalid
: IntegrityCheckLevel.None;
using IFileSystem pfs = PartitionFileSystemUtils.OpenApplicationFileSystem(filePath, _virtualFileSystem);
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
{
using var ncaFile = new UniqueRef<IFile>();
@ -554,7 +554,7 @@ namespace Ryujinx.UI.App.Common
}
return false;
}
public bool TryGetTitleUpdatesFromFile(string filePath, out List<TitleUpdateModel> titleUpdates)
{
titleUpdates = [];
@ -579,7 +579,7 @@ namespace Ryujinx.UI.App.Common
Dictionary<ulong, ContentMetaData> updates =
pfs.GetContentData(ContentMetaType.Patch, _virtualFileSystem, checkLevel);
if (updates.Count == 0)
{
return false;
@ -609,7 +609,7 @@ namespace Ryujinx.UI.App.Common
titleUpdates.Add(update);
}
}
return true;
}
}
@ -737,7 +737,7 @@ namespace Ryujinx.UI.App.Common
AppData = application,
});
}
_applications.Edit(it =>
{
foreach (var application in applications)
@ -783,7 +783,7 @@ namespace Ryujinx.UI.App.Common
_downloadableContents.Edit(it =>
{
it.Clear();
foreach (ApplicationData application in Applications.Items)
{
var res = DownloadableContentsHelper.LoadDownloadableContentsJson(_virtualFileSystem, application.IdBase);
@ -791,18 +791,18 @@ namespace Ryujinx.UI.App.Common
}
});
}
public void SaveDownloadableContentsForGame(ApplicationData application, List<(DownloadableContentModel, bool IsEnabled)> dlcs)
{
_downloadableContents.Edit(it =>
{
DownloadableContentsHelper.SaveDownloadableContentsJson(_virtualFileSystem, application.IdBase, dlcs);
it.Remove(it.Items.Where(item => item.Dlc.TitleIdBase == application.IdBase));
it.AddOrUpdate(dlcs);
});
}
// public void LoadTitleUpdates()
// {
//
@ -812,7 +812,7 @@ namespace Ryujinx.UI.App.Common
{
_cancellationToken = new CancellationTokenSource();
_downloadableContents.Clear();
// Builds the applications list with paths to found applications
List<string> applicationPaths = new();
@ -837,7 +837,8 @@ namespace Ryujinx.UI.App.Common
{
EnumerationOptions options = new()
{
RecurseSubdirectories = true, IgnoreInaccessible = false,
RecurseSubdirectories = true,
IgnoreInaccessible = false,
};
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", options).Where(
@ -896,7 +897,7 @@ namespace Ryujinx.UI.App.Common
DownloadableContent = downloadableContent,
});
}
_downloadableContents.Edit(it =>
{
foreach (var downloadableContent in downloadableContents)
@ -918,7 +919,7 @@ namespace Ryujinx.UI.App.Common
{
_cancellationToken = new CancellationTokenSource();
_titleUpdates.Clear();
// Builds the applications list with paths to found applications
List<string> applicationPaths = new();
@ -943,7 +944,8 @@ namespace Ryujinx.UI.App.Common
{
EnumerationOptions options = new()
{
RecurseSubdirectories = true, IgnoreInaccessible = false,
RecurseSubdirectories = true,
IgnoreInaccessible = false,
};
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", options)
@ -1003,7 +1005,7 @@ namespace Ryujinx.UI.App.Common
TitleUpdate = titleUpdate,
});
}
_titleUpdates.Edit(it =>
{
foreach (var titleUpdate in titleUpdates)
@ -1030,12 +1032,12 @@ namespace Ryujinx.UI.App.Common
{
ApplicationCountUpdated?.Invoke(null, e);
}
protected void OnTitleUpdateAdded(TitleUpdateAddedEventArgs e)
{
TitleUpdateAdded?.Invoke(null, e);
}
protected void OnDownloadableContentAdded(DownloadableContentAddedEventArgs e)
{
DownloadableContentAdded?.Invoke(null, e);
@ -1357,7 +1359,7 @@ namespace Ryujinx.UI.App.Common
return false;
}
private Nca TryOpenNca(IStorage ncaStorage)
{
try

View file

@ -19,7 +19,7 @@ namespace Ryujinx.UI.Common.Helper
public static class DownloadableContentsHelper
{
private static readonly DownloadableContentJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
public static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContentsJson(VirtualFileSystem vfs, ulong applicationIdBase)
{
// _downloadableContentJsonPath = Path.Combine(AppDataManager.GamesDirPath, applicationData.IdBaseString, "dlc.json");
@ -86,7 +86,7 @@ namespace Ryujinx.UI.Common.Helper
private static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContents(VirtualFileSystem vfs, List<DownloadableContentContainer> downloadableContentContainers)
{
var result = new List<(DownloadableContentModel, bool IsEnabled)>();
foreach (DownloadableContentContainer downloadableContentContainer in downloadableContentContainers)
{
if (!File.Exists(downloadableContentContainer.ContainerPath))
@ -127,7 +127,7 @@ namespace Ryujinx.UI.Common.Helper
return result;
}
private static Nca TryOpenNca(VirtualFileSystem vfs, IStorage ncaStorage)
{
try

View file

@ -19,7 +19,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
return BindingOperations.DoNothing;
}
if (values.Count != 2 || !targetType.IsAssignableFrom(typeof(string)))
{
return null;
@ -29,7 +29,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
return null;
}
return isBundled ? $"{LocaleManager.Instance[LocaleKeys.TitleBundledDlcLabel]} {label}" : label;
}

View file

@ -12,14 +12,14 @@ namespace Ryujinx.Ava.UI.Helpers
internal class TitleUpdateLabelConverter : IMultiValueConverter
{
public static TitleUpdateLabelConverter Instance = new();
public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Any(it => it is UnsetValueType))
{
return BindingOperations.DoNothing;
}
if (values.Count != 2 || !targetType.IsAssignableFrom(typeof(string)))
{
return null;
@ -29,7 +29,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
return null;
}
var key = isBundled ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel;
return LocaleManager.Instance.UpdateAndGetDynamicValue(key, label);
}

View file

@ -134,12 +134,12 @@ namespace Ryujinx.Ava.UI.ViewModels
foreach ((DownloadableContentModel dlc, bool isEnabled) in _applicationLibrary.DownloadableContents.Items.Where(it => it.Dlc.TitleIdBase == _applicationData.IdBase))
{
DownloadableContents.Add(dlc);
if (isEnabled)
{
SelectedDownloadableContents.Add(dlc);
}
OnPropertyChanged(nameof(UpdateCount));
}
@ -163,12 +163,12 @@ namespace Ryujinx.Ava.UI.ViewModels
_views.Clear();
_views.AddRange(view);
foreach (DownloadableContentModel item in items)
{
SelectedDownloadableContents.ReplaceOrAdd(item, item);
}
OnPropertyChanged(nameof(Views));
}
@ -291,7 +291,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
SelectedDownloadableContents.ReplaceOrAdd(model, model);
}
public void Disable(DownloadableContentModel model)
{
SelectedDownloadableContents.Remove(model);

View file

@ -22,10 +22,10 @@ using Path = System.IO.Path;
namespace Ryujinx.Ava.UI.ViewModels
{
public record TitleUpdateViewNoUpdateSentinal();
public class TitleUpdateViewModel : BaseModel
{
public TitleUpdateMetadata TitleUpdateWindowData;
public readonly string TitleUpdateJsonPath;
private VirtualFileSystem VirtualFileSystem { get; }
@ -146,7 +146,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
return;
}
try
{
if (!ApplicationLibrary.TryGetTitleUpdatesFromFile(path, out var titleUpdates))
@ -175,7 +175,8 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.InvokeAsync(() => SelectedUpdate = titleUpdate);
}
}
} catch (Exception ex)
}
catch (Exception ex)
{
Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadFileErrorMessage, ex.Message, path)));
}

View file

@ -149,7 +149,7 @@ namespace Ryujinx.Ava.UI.Windows
var it = e.DownloadableContent;
Console.WriteLine("[{0}]: {1} ({2})", it.TitleIdBase, it.ContainerPath, it.FullPath);
}
private void ApplicationLibrary_TitleUpdateAdded(object sender, TitleUpdateAddedEventArgs e)
{
var it = e.TitleUpdate;
@ -664,7 +664,7 @@ namespace Ryujinx.Ava.UI.Windows
};
applicationLibraryThread.Start();
}
private static void TimeIt(string tag, Action act)
{
var watch = System.Diagnostics.Stopwatch.StartNew();