mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-14 22:50:34 +00:00
Apply suggestions from code review
Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
a0128ce8af
commit
dd96f2df10
2 changed files with 8 additions and 7 deletions
|
@ -1357,12 +1357,12 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public async void ManageProfiles()
|
||||
{
|
||||
var prevUserId = AccountManager.LastOpenedUser.UserId;
|
||||
var oldLastOpenedUserId = AccountManager.LastOpenedUser.UserId;
|
||||
await NavigationDialogHost.Show(AccountManager, ContentManager, VirtualFileSystem, LibHacHorizonManager.RyujinxClient);
|
||||
|
||||
if (prevUserId != AccountManager.LastOpenedUser.UserId)
|
||||
if (oldLastOpenedUserId != AccountManager.LastOpenedUser.UserId)
|
||||
{
|
||||
// current user changed, so refresh application metadata
|
||||
// Opened user changed, so refresh application metadata.
|
||||
_ = Task.Run(RefreshApplicationsMetadata);
|
||||
}
|
||||
}
|
||||
|
@ -1377,6 +1377,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
foreach (var app in _applications)
|
||||
{
|
||||
var metadata = ApplicationLibrary.LoadAndSaveMetaData(AccountManager.LastOpenedUser.UserId.ToLibHacFsUid(), app.TitleId);
|
||||
|
||||
app.Favorite = metadata.Favorite;
|
||||
app.LastPlayed = metadata.LastPlayed;
|
||||
app.TimePlayedNum = metadata.TimePlayed;
|
||||
|
|
|
@ -516,14 +516,14 @@ namespace Ryujinx.Ui.App.Common
|
|||
|
||||
Directory.CreateDirectory(metadataFolder);
|
||||
|
||||
// Handle migration from old default to current user
|
||||
// NOTE: Handle migration from old default to current user. Should be removed later.
|
||||
string legacyFile = Path.Combine(guiFolder, "metadata.json");
|
||||
if (File.Exists(legacyFile) && !File.Exists(metadataFile))
|
||||
{
|
||||
File.Move(legacyFile, metadataFile);
|
||||
}
|
||||
|
||||
// Create metadata file if it doesn't exist yet
|
||||
// Create metadata file if it doesn't exist yet.
|
||||
ApplicationMetadata appMetadata;
|
||||
|
||||
if (!File.Exists(metadataFile))
|
||||
|
@ -533,7 +533,7 @@ namespace Ryujinx.Ui.App.Common
|
|||
JsonHelper.SerializeToFile(metadataFile, appMetadata, SerializerContext.ApplicationMetadata);
|
||||
}
|
||||
|
||||
// Read from the metadata file
|
||||
// Read from the metadata file.
|
||||
try
|
||||
{
|
||||
appMetadata = JsonHelper.DeserializeFromFile(metadataFile, SerializerContext.ApplicationMetadata);
|
||||
|
@ -545,7 +545,7 @@ namespace Ryujinx.Ui.App.Common
|
|||
appMetadata = new ApplicationMetadata();
|
||||
}
|
||||
|
||||
// Modify the metadata and save it back to the file
|
||||
// Modify the metadata and save it back to the file.
|
||||
if (modifyFunction != null)
|
||||
{
|
||||
modifyFunction(appMetadata);
|
||||
|
|
Loading…
Reference in a new issue